1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 ;; Exercise the 'sub' LLVM IR: https://llvm.org/docs/LangRef.html#sub-instruction
7 define i1 @sub_i1(i1 %x, i1 %y) {
10 ; LA32-NEXT: sub.w $a0, $a0, $a1
15 ; LA64-NEXT: sub.d $a0, $a0, $a1
21 define i8 @sub_i8(i8 %x, i8 %y) {
24 ; LA32-NEXT: sub.w $a0, $a0, $a1
29 ; LA64-NEXT: sub.d $a0, $a0, $a1
35 define i16 @sub_i16(i16 %x, i16 %y) {
36 ; LA32-LABEL: sub_i16:
38 ; LA32-NEXT: sub.w $a0, $a0, $a1
41 ; LA64-LABEL: sub_i16:
43 ; LA64-NEXT: sub.d $a0, $a0, $a1
49 define i32 @sub_i32(i32 %x, i32 %y) {
50 ; LA32-LABEL: sub_i32:
52 ; LA32-NEXT: sub.w $a0, $a0, $a1
55 ; LA64-LABEL: sub_i32:
57 ; LA64-NEXT: sub.w $a0, $a0, $a1
64 ;; def : PatGprGpr_32<sub, SUB_W>;
65 define signext i32 @sub_i32_sext(i32 %x, i32 %y) {
66 ; LA32-LABEL: sub_i32_sext:
68 ; LA32-NEXT: sub.w $a0, $a0, $a1
71 ; LA64-LABEL: sub_i32_sext:
73 ; LA64-NEXT: sub.w $a0, $a0, $a1
79 define i64 @sub_i64(i64 %x, i64 %y) {
80 ; LA32-LABEL: sub_i64:
82 ; LA32-NEXT: sltu $a4, $a0, $a2
83 ; LA32-NEXT: sub.w $a1, $a1, $a3
84 ; LA32-NEXT: sub.w $a1, $a1, $a4
85 ; LA32-NEXT: sub.w $a0, $a0, $a2
88 ; LA64-LABEL: sub_i64:
90 ; LA64-NEXT: sub.d $a0, $a0, $a1