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.uadd.sat.i4(i4, i4)
5 declare i8 @llvm.uadd.sat.i8(i8, i8)
6 declare i16 @llvm.uadd.sat.i16(i16, i16)
7 declare i32 @llvm.uadd.sat.i32(i32, i32)
8 declare i64 @llvm.uadd.sat.i64(i64, i64)
10 define i32 @func(i32 %x, i32 %y) nounwind {
13 ; CHECK-NEXT: adds w8, w0, w1
14 ; CHECK-NEXT: csinv w0, w8, wzr, lo
16 %tmp = call i32 @llvm.uadd.sat.i32(i32 %x, i32 %y);
20 define i64 @func2(i64 %x, i64 %y) nounwind {
23 ; CHECK-NEXT: adds x8, x0, x1
24 ; CHECK-NEXT: csinv x0, x8, xzr, lo
26 %tmp = call i64 @llvm.uadd.sat.i64(i64 %x, i64 %y);
30 define i16 @func16(i16 %x, i16 %y) nounwind {
31 ; CHECK-LABEL: func16:
33 ; CHECK-NEXT: and w8, w0, #0xffff
34 ; CHECK-NEXT: mov w9, #65535 // =0xffff
35 ; CHECK-NEXT: add w8, w8, w1, uxth
36 ; CHECK-NEXT: cmp w8, w9
37 ; CHECK-NEXT: csel w0, w8, w9, lo
39 %tmp = call i16 @llvm.uadd.sat.i16(i16 %x, i16 %y);
43 define i8 @func8(i8 %x, i8 %y) nounwind {
46 ; CHECK-NEXT: and w9, w0, #0xff
47 ; CHECK-NEXT: mov w8, #255 // =0xff
48 ; CHECK-NEXT: add w9, w9, w1, uxtb
49 ; CHECK-NEXT: cmp w9, #255
50 ; CHECK-NEXT: csel w0, w9, w8, lo
52 %tmp = call i8 @llvm.uadd.sat.i8(i8 %x, i8 %y);
56 define i4 @func3(i4 %x, i4 %y) nounwind {
59 ; CHECK-NEXT: and w9, w1, #0xf
60 ; CHECK-NEXT: and w10, w0, #0xf
61 ; CHECK-NEXT: mov w8, #15 // =0xf
62 ; CHECK-NEXT: add w9, w10, w9
63 ; CHECK-NEXT: cmp w9, #15
64 ; CHECK-NEXT: csel w0, w9, w8, lo
66 %tmp = call i4 @llvm.uadd.sat.i4(i4 %x, i4 %y);