2013-10-04 21:13:15 +08:00
|
|
|
// REQUIRES: arm-registered-target
|
|
|
|
// RUN: %clang_cc1 -triple thumbv7-apple-darwin \
|
2017-05-29 13:38:20 +08:00
|
|
|
// RUN: -disable-O0-optnone \
|
2013-10-04 21:13:15 +08:00
|
|
|
// RUN: -target-cpu cortex-a8 \
|
|
|
|
// RUN: -ffreestanding \
|
2016-03-10 02:54:42 +08:00
|
|
|
// RUN: -emit-llvm -w -o - %s | opt -S -mem2reg | FileCheck %s
|
2013-10-04 21:13:15 +08:00
|
|
|
|
|
|
|
#include <arm_neon.h>
|
|
|
|
|
|
|
|
uint8x8_t test_shift_vshr(uint8x8_t a) {
|
|
|
|
// CHECK-LABEL: test_shift_vshr
|
2013-10-04 22:42:00 +08:00
|
|
|
// CHECK: %{{.*}} = lshr <8 x i8> %a, <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
|
2013-10-04 21:13:15 +08:00
|
|
|
return vshr_n_u8(a, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
int8x8_t test_shift_vshr_smax(int8x8_t a) {
|
|
|
|
// CHECK-LABEL: test_shift_vshr_smax
|
2013-10-04 22:42:00 +08:00
|
|
|
// CHECK: %{{.*}} = ashr <8 x i8> %a, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
|
2013-10-04 21:13:15 +08:00
|
|
|
return vshr_n_s8(a, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8x8_t test_shift_vshr_umax(uint8x8_t a) {
|
|
|
|
// CHECK-LABEL: test_shift_vshr_umax
|
|
|
|
// CHECK: ret <8 x i8> zeroinitializer
|
|
|
|
return vshr_n_u8(a, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8x8_t test_shift_vsra(uint8x8_t a, uint8x8_t b) {
|
|
|
|
// CHECK-LABEL: test_shift_vsra
|
2013-10-04 22:42:00 +08:00
|
|
|
// CHECK: %[[SHR:.*]] = lshr <8 x i8> %b, <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
|
2016-03-10 02:54:42 +08:00
|
|
|
// CHECK: %{{.*}} = add <8 x i8> %a, %[[SHR]]
|
2013-10-04 21:13:15 +08:00
|
|
|
return vsra_n_u8(a, b, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
int8x8_t test_shift_vsra_smax(int8x8_t a, int8x8_t b) {
|
|
|
|
// CHECK-LABEL: test_shift_vsra_smax
|
2013-10-04 22:42:00 +08:00
|
|
|
// CHECK: %[[SHR:.*]] = ashr <8 x i8> %b, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
|
2016-03-10 02:54:42 +08:00
|
|
|
// CHECK: %{{.*}} = add <8 x i8> %a, %[[SHR]]
|
2013-10-04 21:13:15 +08:00
|
|
|
return vsra_n_s8(a, b, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8x8_t test_shift_vsra_umax(uint8x8_t a, uint8x8_t b) {
|
|
|
|
// CHECK-LABEL: test_shift_vsra_umax
|
2016-03-10 02:54:42 +08:00
|
|
|
// CHECK: [[RES:%.*]] = add <8 x i8> %a, zeroinitializer
|
|
|
|
// CHECK: ret <8 x i8> [[RES]]
|
2013-10-04 21:13:15 +08:00
|
|
|
return vsra_n_u8(a, b, 8);
|
|
|
|
}
|