diff options
| author | Roland Paterson-Jones <[email protected]> | 2024-10-23 14:51:53 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2026-01-13 18:11:30 +0100 |
| commit | 5c1eb24e2c312021c7af4316e5adde53e270311a (patch) | |
| tree | e661a5d0c58d58c0f7fb8fc84dba575a800cc646 /util.c | |
| parent | 72010791374d3be2ab21ee5ca1146fce2382d88b (diff) | |
If-conversion RFC 4 - x86 only (for now), use cmovXX
Replacement of tiny conditional jump graphlets with
conditional move instructions.
Currently enabled only for x86. Arm64 support using cselXX
will be essentially identical.
Adds (internal) frontend sel0/sel1 ops with flag-specific
backend xselXX following jnz implementation pattern.
Testing: standard QBE, cproc, harec, hare, roland
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -164,7 +164,7 @@ addins(Ins **pvins, uint *pnins, Ins *i) } void -addbins(Blk *b, Ins **pvins, uint *pnins) +addbins(Ins **pvins, uint *pnins, Blk *b) { Ins *i; @@ -281,6 +281,17 @@ igroup(Blk *b, Ins *i, Ins **i0, Ins **i1) assert(i < ie); *i1 = i + 1; return; + case Osel1: + for (; i>ib && (i-1)->op == Osel1; i--) + ; + assert(i->op == Osel0); + /* fall through */ + case Osel0: + *i0 = i++; + for (; i<ie && i->op == Osel1; i++) + ; + *i1 = i; + return; default: if (ispar(i->op)) goto case_Opar; |
