xref: /llvm-project/llvm/test/CodeGen/LoongArch/sext-cheaper-than-zext.ll (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s
3
4define signext i32 @sext_icmp(i32 signext %x, i32 signext %y) {
5; CHECK-LABEL: sext_icmp:
6; CHECK:       # %bb.0:
7; CHECK-NEXT:    addi.w $a0, $a0, 1
8; CHECK-NEXT:    xor $a0, $a0, $a1
9; CHECK-NEXT:    sltu $a0, $zero, $a0
10; CHECK-NEXT:    ret
11  %1 = add nsw i32 %x, 1
12  %2 = icmp ne i32 %1, %y
13  %3 = zext i1 %2 to i32
14  ret i32 %3
15}
16