1 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck %s
3 define i8 @test_i8(i8 %a) nounwind {
4 ; CHECK-LABEL: test_i8:
6 ; CHECK-NEXT: sxtb w8, w0
7 ; CHECK-NEXT: cmp w8, #0
8 ; CHECK-NEXT: cneg w0, w8, mi
10 %tmp1neg = sub i8 0, %a
11 %b = icmp sgt i8 %a, -1
12 %abs = select i1 %b, i8 %a, i8 %tmp1neg
16 define i16 @test_i16(i16 %a) nounwind {
17 ; CHECK-LABEL: test_i16:
19 ; CHECK-NEXT: sxth w8, w0
20 ; CHECK-NEXT: cmp w8, #0
21 ; CHECK-NEXT: cneg w0, w8, mi
23 %tmp1neg = sub i16 0, %a
24 %b = icmp sgt i16 %a, -1
25 %abs = select i1 %b, i16 %a, i16 %tmp1neg
29 define i32 @test_i32(i32 %a) nounwind {
30 ; CHECK-LABEL: test_i32:
32 ; CHECK-NEXT: cmp w0, #0
33 ; CHECK-NEXT: cneg w0, w0, mi
35 %tmp1neg = sub i32 0, %a
36 %b = icmp sgt i32 %a, -1
37 %abs = select i1 %b, i32 %a, i32 %tmp1neg
41 define i64 @test_i64(i64 %a) nounwind {
42 ; CHECK-LABEL: test_i64:
44 ; CHECK-NEXT: cmp x0, #0
45 ; CHECK-NEXT: cneg x0, x0, mi
47 %tmp1neg = sub i64 0, %a
48 %b = icmp sgt i64 %a, -1
49 %abs = select i1 %b, i64 %a, i64 %tmp1neg