Skip to content

Commit

Permalink
[EraVM] Add pre-commit test for xor optimization bug
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Radosavljevic <[email protected]>
  • Loading branch information
vladimirradosavljevic committed Apr 2, 2024
1 parent 90d2f82 commit 122a2f8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions llvm/test/CodeGen/EraVM/xor-opt-bug.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -O3 < %s | FileCheck %s

target datalayout = "E-p:256:256-i256:256:256-S32-a:256:256"
target triple = "eravm"

define i256 @test(i256 %a) {
; CHECK-LABEL: test:
; CHECK: ; %bb.0:
; CHECK-NEXT: sub! r1, r0, r1
; CHECK-NEXT: add 0, r0, r1
; CHECK-NEXT: add.eq 1, r0, r1
; CHECK-NEXT: ret
%cmp = icmp ne i256 %a, 0
%zext = zext i1 %cmp to i256
%xor = xor i256 %zext, -1
ret i256 %xor
}

0 comments on commit 122a2f8

Please sign in to comment.