xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/aarch64-neon-shifts.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // REQUIRES: aarch64-registered-target
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3f4a2713aSLionel Sambuc // RUN:   -ffp-contract=fast -S -emit-llvm -O1 -o - %s | FileCheck %s
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc #include <arm_neon.h>
6f4a2713aSLionel Sambuc 
test_shift_vshr(uint8x8_t a)7f4a2713aSLionel Sambuc uint8x8_t test_shift_vshr(uint8x8_t a) {
8f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vshr
9f4a2713aSLionel Sambuc   // CHECK: %{{.*}} = lshr <8 x i8> %a, <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
10f4a2713aSLionel Sambuc   return vshr_n_u8(a, 5);
11f4a2713aSLionel Sambuc }
12f4a2713aSLionel Sambuc 
test_shift_vshr_smax(int8x8_t a)13f4a2713aSLionel Sambuc int8x8_t test_shift_vshr_smax(int8x8_t a) {
14f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vshr_smax
15f4a2713aSLionel Sambuc   // CHECK: %{{.*}} = ashr <8 x i8> %a, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
16f4a2713aSLionel Sambuc   return vshr_n_s8(a, 8);
17f4a2713aSLionel Sambuc }
18f4a2713aSLionel Sambuc 
test_shift_vshr_umax(uint8x8_t a)19f4a2713aSLionel Sambuc uint8x8_t test_shift_vshr_umax(uint8x8_t a) {
20f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vshr_umax
21f4a2713aSLionel Sambuc   // CHECK: ret <8 x i8> zeroinitializer
22f4a2713aSLionel Sambuc   return vshr_n_u8(a, 8);
23f4a2713aSLionel Sambuc }
24f4a2713aSLionel Sambuc 
test_shift_vsra(uint8x8_t a,uint8x8_t b)25f4a2713aSLionel Sambuc uint8x8_t test_shift_vsra(uint8x8_t a, uint8x8_t b) {
26f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vsra
27f4a2713aSLionel Sambuc   // CHECK: %[[SHR:.*]] = lshr <8 x i8> %b, <i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5, i8 5>
28f4a2713aSLionel Sambuc   // CHECK: %{{.*}} = add <8 x i8> %[[SHR]], %a
29f4a2713aSLionel Sambuc   return vsra_n_u8(a, b, 5);
30f4a2713aSLionel Sambuc }
31f4a2713aSLionel Sambuc 
test_shift_vsra_smax(int8x8_t a,int8x8_t b)32f4a2713aSLionel Sambuc int8x8_t test_shift_vsra_smax(int8x8_t a, int8x8_t b) {
33f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vsra_smax
34f4a2713aSLionel Sambuc   // CHECK: %[[SHR:.*]] = ashr <8 x i8> %b, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
35f4a2713aSLionel Sambuc   // CHECK: %{{.*}} = add <8 x i8> %[[SHR]], %a
36f4a2713aSLionel Sambuc   return vsra_n_s8(a, b, 8);
37f4a2713aSLionel Sambuc }
38f4a2713aSLionel Sambuc 
test_shift_vsra_umax(uint8x8_t a,uint8x8_t b)39f4a2713aSLionel Sambuc uint8x8_t test_shift_vsra_umax(uint8x8_t a, uint8x8_t b) {
40f4a2713aSLionel Sambuc   // CHECK-LABEL: test_shift_vsra_umax
41f4a2713aSLionel Sambuc   // CHECK: ret <8 x i8> %a
42f4a2713aSLionel Sambuc   return vsra_n_u8(a, b, 8);
43f4a2713aSLionel Sambuc }
44