1 ; RUN: llc -mtriple=arm-eabi -mattr=+neon %s -o - | FileCheck %s
3 define <4 x i32> @test1(<4 x i32> %a) nounwind {
6 %tmp1neg = sub <4 x i32> zeroinitializer, %a
7 %b = icmp sgt <4 x i32> %a, <i32 -1, i32 -1, i32 -1, i32 -1>
8 %abs = select <4 x i1> %b, <4 x i32> %a, <4 x i32> %tmp1neg
12 define <4 x i32> @test2(<4 x i32> %a) nounwind {
15 %tmp1neg = sub <4 x i32> zeroinitializer, %a
16 %b = icmp sge <4 x i32> %a, zeroinitializer
17 %abs = select <4 x i1> %b, <4 x i32> %a, <4 x i32> %tmp1neg
21 define <8 x i16> @test3(<8 x i16> %a) nounwind {
24 %tmp1neg = sub <8 x i16> zeroinitializer, %a
25 %b = icmp sgt <8 x i16> %a, zeroinitializer
26 %abs = select <8 x i1> %b, <8 x i16> %a, <8 x i16> %tmp1neg
30 define <16 x i8> @test4(<16 x i8> %a) nounwind {
33 %tmp1neg = sub <16 x i8> zeroinitializer, %a
34 %b = icmp slt <16 x i8> %a, zeroinitializer
35 %abs = select <16 x i1> %b, <16 x i8> %tmp1neg, <16 x i8> %a
39 define <4 x i32> @test5(<4 x i32> %a) nounwind {
42 %tmp1neg = sub <4 x i32> zeroinitializer, %a
43 %b = icmp sle <4 x i32> %a, zeroinitializer
44 %abs = select <4 x i1> %b, <4 x i32> %tmp1neg, <4 x i32> %a
48 define <2 x i32> @test6(<2 x i32> %a) nounwind {
51 %tmp1neg = sub <2 x i32> zeroinitializer, %a
52 %b = icmp sgt <2 x i32> %a, <i32 -1, i32 -1>
53 %abs = select <2 x i1> %b, <2 x i32> %a, <2 x i32> %tmp1neg
57 define <2 x i32> @test7(<2 x i32> %a) nounwind {
60 %tmp1neg = sub <2 x i32> zeroinitializer, %a
61 %b = icmp sge <2 x i32> %a, zeroinitializer
62 %abs = select <2 x i1> %b, <2 x i32> %a, <2 x i32> %tmp1neg
66 define <4 x i16> @test8(<4 x i16> %a) nounwind {
69 %tmp1neg = sub <4 x i16> zeroinitializer, %a
70 %b = icmp sgt <4 x i16> %a, zeroinitializer
71 %abs = select <4 x i1> %b, <4 x i16> %a, <4 x i16> %tmp1neg
75 define <8 x i8> @test9(<8 x i8> %a) nounwind {
78 %tmp1neg = sub <8 x i8> zeroinitializer, %a
79 %b = icmp slt <8 x i8> %a, zeroinitializer
80 %abs = select <8 x i1> %b, <8 x i8> %tmp1neg, <8 x i8> %a
84 define <2 x i32> @test10(<2 x i32> %a) nounwind {
85 ; CHECK-LABEL: test10:
87 %tmp1neg = sub <2 x i32> zeroinitializer, %a
88 %b = icmp sle <2 x i32> %a, zeroinitializer
89 %abs = select <2 x i1> %b, <2 x i32> %tmp1neg, <2 x i32> %a
93 ;; Check that absdiff patterns as emitted by log2 shuffles are
96 define <4 x i32> @test11(<4 x i16> %a, <4 x i16> %b) nounwind {
97 ; CHECK-LABEL: test11:
99 %zext1 = zext <4 x i16> %a to <4 x i32>
100 %zext2 = zext <4 x i16> %b to <4 x i32>
101 %diff = sub <4 x i32> %zext1, %zext2
102 %shift1 = ashr <4 x i32> %diff, <i32 31, i32 31, i32 31, i32 31>
103 %add1 = add <4 x i32> %shift1, %diff
104 %res = xor <4 x i32> %shift1, %add1
107 define <8 x i16> @test12(<8 x i8> %a, <8 x i8> %b) nounwind {
108 ; CHECK-LABEL: test12:
110 %zext1 = zext <8 x i8> %a to <8 x i16>
111 %zext2 = zext <8 x i8> %b to <8 x i16>
112 %diff = sub <8 x i16> %zext1, %zext2
113 %shift1 = ashr <8 x i16> %diff,<i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
114 %add1 = add <8 x i16> %shift1, %diff
115 %res = xor <8 x i16> %shift1, %add1
119 define <2 x i64> @test13(<2 x i32> %a, <2 x i32> %b) nounwind {
120 ; CHECK-LABEL: test13:
122 %zext1 = zext <2 x i32> %a to <2 x i64>
123 %zext2 = zext <2 x i32> %b to <2 x i64>
124 %diff = sub <2 x i64> %zext1, %zext2
125 %shift1 = ashr <2 x i64> %diff,<i64 63, i64 63>
126 %add1 = add <2 x i64> %shift1, %diff
127 %res = xor <2 x i64> %shift1, %add1