46 lines · c
1// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \2// RUN: -disable-O0-optnone -ffp-contract=fast -emit-llvm -o - %s | opt -S -passes=mem2reg | FileCheck %s3 4// REQUIRES: aarch64-registered-target || arm-registered-target5 6#include <arm_neon.h>7 8uint8x8_t test_shift_vshr(uint8x8_t a) {9 // CHECK-LABEL: test_shift_vshr10 // CHECK: %{{.*}} = lshr <8 x i8> %a, splat (i8 5)11 return vshr_n_u8(a, 5);12}13 14int8x8_t test_shift_vshr_smax(int8x8_t a) {15 // CHECK-LABEL: test_shift_vshr_smax16 // CHECK: %{{.*}} = ashr <8 x i8> %a, splat (i8 7)17 return vshr_n_s8(a, 8);18}19 20uint8x8_t test_shift_vshr_umax(uint8x8_t a) {21 // CHECK-LABEL: test_shift_vshr_umax22 // CHECK: ret <8 x i8> zeroinitializer23 return vshr_n_u8(a, 8);24}25 26uint8x8_t test_shift_vsra(uint8x8_t a, uint8x8_t b) {27 // CHECK-LABEL: test_shift_vsra28 // CHECK: %[[SHR:.*]] = lshr <8 x i8> %b, splat (i8 5)29 // CHECK: %{{.*}} = add <8 x i8> %a, %[[SHR]]30 return vsra_n_u8(a, b, 5);31}32 33int8x8_t test_shift_vsra_smax(int8x8_t a, int8x8_t b) {34 // CHECK-LABEL: test_shift_vsra_smax35 // CHECK: %[[SHR:.*]] = ashr <8 x i8> %b, splat (i8 7)36 // CHECK: %{{.*}} = add <8 x i8> %a, %[[SHR]]37 return vsra_n_s8(a, b, 8);38}39 40uint8x8_t test_shift_vsra_umax(uint8x8_t a, uint8x8_t b) {41 // CHECK-LABEL: test_shift_vsra_umax42 // CHECK: [[RES:%.*]] = add <8 x i8> %a, zeroinitializer43 // CHECK: ret <8 x i8> [[RES]]44 return vsra_n_u8(a, b, 8);45}46