[ARM] MVE integer abs
[llvm-core.git] / test / CodeGen / Thumb2 / mve-abs.ll
blobe0af56abf123b06b12f501a938620d1c19a11d2f
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve -verify-machineinstrs %s -o - | FileCheck %s
4 define arm_aapcs_vfpcc <16 x i8> @abs_v16i8(<16 x i8> %s1) {
5 ; CHECK-LABEL: abs_v16i8:
6 ; CHECK:       @ %bb.0: @ %entry
7 ; CHECK-NEXT:    vabs.s8 q0, q0
8 ; CHECK-NEXT:    bx lr
9 entry:
10   %0 = icmp slt <16 x i8> %s1, zeroinitializer
11   %1 = sub nsw <16 x i8> zeroinitializer, %s1
12   %2 = select <16 x i1> %0, <16 x i8> %1, <16 x i8> %s1
13   ret <16 x i8> %2
16 define arm_aapcs_vfpcc <8 x i16> @abs_v8i16(<8 x i16> %s1) {
17 ; CHECK-LABEL: abs_v8i16:
18 ; CHECK:       @ %bb.0: @ %entry
19 ; CHECK-NEXT:    vabs.s16 q0, q0
20 ; CHECK-NEXT:    bx lr
21 entry:
22   %0 = icmp slt <8 x i16> %s1, zeroinitializer
23   %1 = sub nsw <8 x i16> zeroinitializer, %s1
24   %2 = select <8 x i1> %0, <8 x i16> %1, <8 x i16> %s1
25   ret <8 x i16> %2
28 define arm_aapcs_vfpcc <4 x i32> @abs_v4i32(<4 x i32> %s1) {
29 ; CHECK-LABEL: abs_v4i32:
30 ; CHECK:       @ %bb.0: @ %entry
31 ; CHECK-NEXT:    vabs.s32 q0, q0
32 ; CHECK-NEXT:    bx lr
33 entry:
34   %0 = icmp slt <4 x i32> %s1, zeroinitializer
35   %1 = sub nsw <4 x i32> zeroinitializer, %s1
36   %2 = select <4 x i1> %0, <4 x i32> %1, <4 x i32> %s1
37   ret <4 x i32> %2