1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
4 declare i4 @llvm.usub.sat.i4(i4, i4)
5 declare i8 @llvm.usub.sat.i8(i8, i8)
6 declare i16 @llvm.usub.sat.i16(i16, i16)
7 declare i32 @llvm.usub.sat.i32(i32, i32)
8 declare i64 @llvm.usub.sat.i64(i64, i64)
10 define i32 @func(i32 %x, i32 %y) nounwind {
13 ; CHECK-NEXT: subs w8, w0, w1
14 ; CHECK-NEXT: csel w0, wzr, w8, lo
16 %tmp = call i32 @llvm.usub.sat.i32(i32 %x, i32 %y);
20 define i64 @func2(i64 %x, i64 %y) nounwind {
23 ; CHECK-NEXT: subs x8, x0, x1
24 ; CHECK-NEXT: csel x0, xzr, x8, lo
26 %tmp = call i64 @llvm.usub.sat.i64(i64 %x, i64 %y);
30 define i16 @func16(i16 %x, i16 %y) nounwind {
31 ; CHECK-LABEL: func16:
33 ; CHECK-NEXT: and w8, w1, #0xffff
34 ; CHECK-NEXT: and w9, w0, #0xffff
35 ; CHECK-NEXT: cmp w9, w8
36 ; CHECK-NEXT: csel w9, w9, w8, hi
37 ; CHECK-NEXT: sub w0, w9, w8
39 %tmp = call i16 @llvm.usub.sat.i16(i16 %x, i16 %y);
43 define i8 @func8(i8 %x, i8 %y) nounwind {
46 ; CHECK-NEXT: and w8, w1, #0xff
47 ; CHECK-NEXT: and w9, w0, #0xff
48 ; CHECK-NEXT: cmp w9, w8
49 ; CHECK-NEXT: csel w9, w9, w8, hi
50 ; CHECK-NEXT: sub w0, w9, w8
52 %tmp = call i8 @llvm.usub.sat.i8(i8 %x, i8 %y);
56 define i4 @func3(i4 %x, i4 %y) nounwind {
59 ; CHECK-NEXT: and w8, w1, #0xf
60 ; CHECK-NEXT: and w9, w0, #0xf
61 ; CHECK-NEXT: cmp w9, w8
62 ; CHECK-NEXT: csel w9, w9, w8, hi
63 ; CHECK-NEXT: sub w0, w9, w8
65 %tmp = call i4 @llvm.usub.sat.i4(i4 %x, i4 %y);