1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
3 ; RUN: llc < %s -mtriple=arm64-eabi -mattr=+cssc | FileCheck %s -check-prefix=CHECK-CSSC
5 define i8 @test_i8(i8 %a) nounwind {
6 ; CHECK-LABEL: test_i8:
8 ; CHECK-NEXT: sxtb w8, w0
9 ; CHECK-NEXT: cmp w8, #0
10 ; CHECK-NEXT: cneg w0, w8, mi
13 ; CHECK-CSSC-LABEL: test_i8:
14 ; CHECK-CSSC: // %bb.0:
15 ; CHECK-CSSC-NEXT: sxtb w8, w0
16 ; CHECK-CSSC-NEXT: abs w0, w8
17 ; CHECK-CSSC-NEXT: ret
18 %tmp1neg = sub i8 0, %a
19 %b = icmp sgt i8 %a, -1
20 %abs = select i1 %b, i8 %a, i8 %tmp1neg
24 define i16 @test_i16(i16 %a) nounwind {
25 ; CHECK-LABEL: test_i16:
27 ; CHECK-NEXT: sxth w8, w0
28 ; CHECK-NEXT: cmp w8, #0
29 ; CHECK-NEXT: cneg w0, w8, mi
32 ; CHECK-CSSC-LABEL: test_i16:
33 ; CHECK-CSSC: // %bb.0:
34 ; CHECK-CSSC-NEXT: sxth w8, w0
35 ; CHECK-CSSC-NEXT: abs w0, w8
36 ; CHECK-CSSC-NEXT: ret
37 %tmp1neg = sub i16 0, %a
38 %b = icmp sgt i16 %a, -1
39 %abs = select i1 %b, i16 %a, i16 %tmp1neg
43 define i32 @test_i32(i32 %a) nounwind {
44 ; CHECK-LABEL: test_i32:
46 ; CHECK-NEXT: cmp w0, #0
47 ; CHECK-NEXT: cneg w0, w0, mi
50 ; CHECK-CSSC-LABEL: test_i32:
51 ; CHECK-CSSC: // %bb.0:
52 ; CHECK-CSSC-NEXT: abs w0, w0
53 ; CHECK-CSSC-NEXT: ret
54 %tmp1neg = sub i32 0, %a
55 %b = icmp sgt i32 %a, -1
56 %abs = select i1 %b, i32 %a, i32 %tmp1neg
60 define i64 @test_i64(i64 %a) nounwind {
61 ; CHECK-LABEL: test_i64:
63 ; CHECK-NEXT: cmp x0, #0
64 ; CHECK-NEXT: cneg x0, x0, mi
67 ; CHECK-CSSC-LABEL: test_i64:
68 ; CHECK-CSSC: // %bb.0:
69 ; CHECK-CSSC-NEXT: abs x0, x0
70 ; CHECK-CSSC-NEXT: ret
71 %tmp1neg = sub i64 0, %a
72 %b = icmp sgt i64 %a, -1
73 %abs = select i1 %b, i64 %a, i64 %tmp1neg