xref: /llvm-project/llvm/test/CodeGen/LoongArch/prefer-w-inst.ll (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc --mtriple=loongarch64 -mattr=+d --verify-machineinstrs < %s \
3; RUN:   | FileCheck --check-prefixes=NO-PREFER-W-INST %s
4; RUN: llc --mtriple=loongarch64 -mattr=+d --loongarch-disable-cvt-to-d-suffix --verify-machineinstrs < %s \
5; RUN:   | FileCheck --check-prefixes=NO-CVT-D-INST %s
6; RUN: llc --mtriple=loongarch64 --mattr=+prefer-w-inst --verify-machineinstrs < %s \
7; RUN:   | FileCheck --check-prefixes=PREFER-W-INST %s
8
9define signext i32 @addw(i32 %x) {
10; NO-PREFER-W-INST-LABEL: addw:
11; NO-PREFER-W-INST:       # %bb.0:
12; NO-PREFER-W-INST-NEXT:    addi.d $a0, $a0, 2047
13; NO-PREFER-W-INST-NEXT:    addi.w $a0, $a0, 2033
14; NO-PREFER-W-INST-NEXT:    ret
15;
16; NO-CVT-D-INST-LABEL: addw:
17; NO-CVT-D-INST:       # %bb.0:
18; NO-CVT-D-INST-NEXT:    addi.w $a0, $a0, 2047
19; NO-CVT-D-INST-NEXT:    addi.w $a0, $a0, 2033
20; NO-CVT-D-INST-NEXT:    ret
21;
22; PREFER-W-INST-LABEL: addw:
23; PREFER-W-INST:       # %bb.0:
24; PREFER-W-INST-NEXT:    addi.w $a0, $a0, 2047
25; PREFER-W-INST-NEXT:    addi.w $a0, $a0, 2033
26; PREFER-W-INST-NEXT:    ret
27  %add = add i32 %x, 4080
28  ret i32 %add
29}
30