1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc < %s -mtriple=aarch64-- -global-isel -global-isel-abort=2 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 declare i4 @llvm.usub.sat.i4(i4, i4)
6 declare i8 @llvm.usub.sat.i8(i8, i8)
7 declare i16 @llvm.usub.sat.i16(i16, i16)
8 declare i32 @llvm.usub.sat.i32(i32, i32)
9 declare i64 @llvm.usub.sat.i64(i64, i64)
11 define i32 @func(i32 %x, i32 %y) nounwind {
12 ; CHECK-SD-LABEL: func:
14 ; CHECK-SD-NEXT: subs w8, w0, w1
15 ; CHECK-SD-NEXT: csel w0, wzr, w8, lo
18 ; CHECK-GI-LABEL: func:
20 ; CHECK-GI-NEXT: subs w8, w0, w1
21 ; CHECK-GI-NEXT: cset w9, lo
22 ; CHECK-GI-NEXT: tst w9, #0x1
23 ; CHECK-GI-NEXT: csel w0, wzr, w8, ne
25 %tmp = call i32 @llvm.usub.sat.i32(i32 %x, i32 %y);
29 define i64 @func2(i64 %x, i64 %y) nounwind {
30 ; CHECK-SD-LABEL: func2:
32 ; CHECK-SD-NEXT: subs x8, x0, x1
33 ; CHECK-SD-NEXT: csel x0, xzr, x8, lo
36 ; CHECK-GI-LABEL: func2:
38 ; CHECK-GI-NEXT: subs x8, x0, x1
39 ; CHECK-GI-NEXT: cset w9, lo
40 ; CHECK-GI-NEXT: tst w9, #0x1
41 ; CHECK-GI-NEXT: csel x0, xzr, x8, ne
43 %tmp = call i64 @llvm.usub.sat.i64(i64 %x, i64 %y);
47 define i16 @func16(i16 %x, i16 %y) nounwind {
48 ; CHECK-SD-LABEL: func16:
50 ; CHECK-SD-NEXT: and w8, w0, #0xffff
51 ; CHECK-SD-NEXT: subs w8, w8, w1, uxth
52 ; CHECK-SD-NEXT: csel w0, wzr, w8, lo
55 ; CHECK-GI-LABEL: func16:
57 ; CHECK-GI-NEXT: and w8, w0, #0xffff
58 ; CHECK-GI-NEXT: sub w8, w8, w1, uxth
59 ; CHECK-GI-NEXT: cmp w8, w8, uxth
60 ; CHECK-GI-NEXT: csel w0, wzr, w8, ne
62 %tmp = call i16 @llvm.usub.sat.i16(i16 %x, i16 %y);
66 define i8 @func8(i8 %x, i8 %y) nounwind {
67 ; CHECK-SD-LABEL: func8:
69 ; CHECK-SD-NEXT: and w8, w0, #0xff
70 ; CHECK-SD-NEXT: subs w8, w8, w1, uxtb
71 ; CHECK-SD-NEXT: csel w0, wzr, w8, lo
74 ; CHECK-GI-LABEL: func8:
76 ; CHECK-GI-NEXT: and w8, w0, #0xff
77 ; CHECK-GI-NEXT: sub w8, w8, w1, uxtb
78 ; CHECK-GI-NEXT: cmp w8, w8, uxtb
79 ; CHECK-GI-NEXT: csel w0, wzr, w8, ne
81 %tmp = call i8 @llvm.usub.sat.i8(i8 %x, i8 %y);
85 define i4 @func3(i4 %x, i4 %y) nounwind {
86 ; CHECK-SD-LABEL: func3:
88 ; CHECK-SD-NEXT: and w8, w1, #0xf
89 ; CHECK-SD-NEXT: and w9, w0, #0xf
90 ; CHECK-SD-NEXT: subs w8, w9, w8
91 ; CHECK-SD-NEXT: csel w0, wzr, w8, lo
94 ; CHECK-GI-LABEL: func3:
96 ; CHECK-GI-NEXT: and w8, w0, #0xf
97 ; CHECK-GI-NEXT: and w9, w1, #0xf
98 ; CHECK-GI-NEXT: sub w8, w8, w9
99 ; CHECK-GI-NEXT: and w9, w8, #0xf
100 ; CHECK-GI-NEXT: cmp w8, w9
101 ; CHECK-GI-NEXT: csel w0, wzr, w8, ne
103 %tmp = call i4 @llvm.usub.sat.i4(i4 %x, i4 %y);
106 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: