diff options
Diffstat (limited to 'llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll')
| -rw-r--r-- | llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll b/llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll index b16672d3c4a1..55b0d1f0bf7b 100644 --- a/llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll +++ b/llvm/test/CodeGen/RISCV/and-negpow2-cmp.ll @@ -64,3 +64,94 @@ define i1 @test4(i64 %x) { %b = icmp eq i64 %a, 0 ret i1 %b } + +define i1 @test5(i64 %x) { +; RV32-LABEL: test5: +; RV32: # %bb.0: +; RV32-NEXT: srli a0, a0, 29 +; RV32-NEXT: seqz a0, a0 +; RV32-NEXT: ret +; +; RV64-LABEL: test5: +; RV64: # %bb.0: +; RV64-NEXT: sraiw a0, a0, 29 +; RV64-NEXT: seqz a0, a0 +; RV64-NEXT: ret + %a = and i64 %x, u0xE0000000 + %b = icmp eq i64 %a, 0 + ret i1 %b +} + +define i1 @test6(i64 %x) { +; RV32-LABEL: test6: +; RV32: # %bb.0: +; RV32-NEXT: srli a0, a0, 29 +; RV32-NEXT: snez a0, a0 +; RV32-NEXT: ret +; +; RV64-LABEL: test6: +; RV64: # %bb.0: +; RV64-NEXT: sraiw a0, a0, 29 +; RV64-NEXT: snez a0, a0 +; RV64-NEXT: ret + %a = and i64 %x, u0xE0000000 + %b = icmp ne i64 %a, 0 + ret i1 %b +} + +define i1 @test7(i64 %x) { +; RV32-LABEL: test7: +; RV32: # %bb.0: +; RV32-NEXT: srli a0, a0, 29 +; RV32-NEXT: addi a0, a0, -6 +; RV32-NEXT: seqz a0, a0 +; RV32-NEXT: ret +; +; RV64-LABEL: test7: +; RV64: # %bb.0: +; RV64-NEXT: sraiw a0, a0, 29 +; RV64-NEXT: addi a0, a0, 2 +; RV64-NEXT: seqz a0, a0 +; RV64-NEXT: ret + %a = and i64 %x, u0xE0000000 + %b = icmp eq i64 %a, u0xC0000000 + ret i1 %b +} + +define i1 @test8(i64 %x) { +; RV32-LABEL: test8: +; RV32: # %bb.0: +; RV32-NEXT: srai a0, a0, 20 +; RV32-NEXT: xori a0, a0, -2048 +; RV32-NEXT: snez a0, a0 +; RV32-NEXT: ret +; +; RV64-LABEL: test8: +; RV64: # %bb.0: +; RV64-NEXT: sraiw a0, a0, 20 +; RV64-NEXT: xori a0, a0, -2048 +; RV64-NEXT: snez a0, a0 +; RV64-NEXT: ret + %a = and i64 %x, u0xFFF00000 + %b = icmp ne i64 %a, u0x80000000 + ret i1 %b +} + +define i1 @test9(i64 %x) { +; RV32-LABEL: test9: +; RV32: # %bb.0: +; RV32-NEXT: srli a0, a0, 16 +; RV32-NEXT: addi a0, a0, -2048 +; RV32-NEXT: seqz a0, a0 +; RV32-NEXT: ret +; +; RV64-LABEL: test9: +; RV64: # %bb.0: +; RV64-NEXT: sraiw a0, a0, 16 +; RV64-NEXT: addi a0, a0, -2048 +; RV64-NEXT: seqz a0, a0 +; RV64-NEXT: ret + %a = and i64 %x, u0xFFFF0000 + %b = icmp eq i64 %a, u0x08000000 + ret i1 %b +} |
