Skip to content

Commit b32c5cc

Browse files
committed
[EVM][ISel] Select (setcc x, 0, ne) as ISZERO ISZERO
Before the patch it was selected as `PUSH0 EQ ISZERO`.
1 parent 9db5493 commit b32c5cc

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

llvm/lib/Target/EVM/EVMInstrInfo.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def : Pat<(setcc GPR:$rs0, GPR:$rs1, SETULE),
338338
def : Pat<(setcc GPR:$rs0, GPR:$rs1, SETUGE),
339339
(ISZERO (ULT GPR:$rs0, GPR:$rs1))>;
340340

341+
def : Pat<(setcc GPR:$rs0, 0, SETNE), (ISZERO (ISZERO GPR:$rs0))>;
341342

342343
//===----------------------------------------------------------------------===//
343344
// EVM bitwise instructions.

llvm/test/CodeGen/EVM/jumps-are-expensive.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ define i256 @test(i256 %a, i256 %b) {
1111
; CHECK: ; %bb.0: ; %bb1
1212
; CHECK-NEXT: JUMPDEST
1313
; CHECK-NEXT: SWAP1
14-
; CHECK-NEXT: PUSH0
15-
; CHECK-NEXT: EQ
14+
; CHECK-NEXT: ISZERO
1615
; CHECK-NEXT: ISZERO
1716
; CHECK-NEXT: SWAP1
18-
; CHECK-NEXT: PUSH0
19-
; CHECK-NEXT: EQ
17+
; CHECK-NEXT: ISZERO
2018
; CHECK-NEXT: ISZERO
2119
; CHECK-NEXT: AND
2220
; CHECK-NEXT: PUSH4 @.BB0_2

llvm/test/CodeGen/EVM/setcc-with-0-selection.ll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ define i1 @test_ne(i256 %x) {
1818
; CHECK-LABEL: test_ne:
1919
; CHECK: ; %bb.0:
2020
; CHECK-NEXT: JUMPDEST
21-
; CHECK-NEXT: PUSH0
22-
; CHECK-NEXT: EQ
21+
; CHECK-NEXT: ISZERO
2322
; CHECK-NEXT: ISZERO
2423
; CHECK-NEXT: SWAP1
2524
; CHECK-NEXT: JUMP

0 commit comments

Comments
 (0)