From: Ahmed Bougacha Date: Mon, 24 Aug 2015 23:34:25 +0000 (+0000) Subject: [ARM NEON] Add missing AArch64 vget tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3495adf9a09756eb9896efb0c6967dad89a9ce18;p=clang [ARM NEON] Add missing AArch64 vget tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245901 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/aarch64-neon-vget.c b/test/CodeGen/aarch64-neon-vget.c new file mode 100644 index 0000000000..83c64943da --- /dev/null +++ b/test/CodeGen/aarch64-neon-vget.c @@ -0,0 +1,348 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple arm64-apple-darwin -target-feature +neon \ +// RUN: -ffp-contract=fast -S -O3 -o - %s | FileCheck %s + +#include + +uint8_t test_vget_lane_u8(uint8x8_t a) { + // CHECK-LABEL: test_vget_lane_u8: + // CHECK-NEXT: umov.b w0, v0[7] + // CHECK-NEXT: ret + return vget_lane_u8(a, 7); +} + +uint16_t test_vget_lane_u16(uint16x4_t a) { + // CHECK-LABEL: test_vget_lane_u16: + // CHECK-NEXT: umov.h w0, v0[3] + // CHECK-NEXT: ret + return vget_lane_u16(a, 3); +} + +uint32_t test_vget_lane_u32(uint32x2_t a) { + // CHECK-LABEL: test_vget_lane_u32: + // CHECK-NEXT: mov.s w0, v0[1] + // CHECK-NEXT: ret + return vget_lane_u32(a, 1); +} + +int8_t test_vget_lane_s8(int8x8_t a) { + // CHECK-LABEL: test_vget_lane_s8: + // CHECK-NEXT: umov.b w0, v0[7] + // CHECK-NEXT: ret + return vget_lane_s8(a, 7); +} + +int16_t test_vget_lane_s16(int16x4_t a) { + // CHECK-LABEL: test_vget_lane_s16: + // CHECK-NEXT: umov.h w0, v0[3] + // CHECK-NEXT: ret + return vget_lane_s16(a, 3); +} + +int32_t test_vget_lane_s32(int32x2_t a) { + // CHECK-LABEL: test_vget_lane_s32: + // CHECK-NEXT: mov.s w0, v0[1] + // CHECK-NEXT: ret + return vget_lane_s32(a, 1); +} + +poly8_t test_vget_lane_p8(poly8x8_t a) { + // CHECK-LABEL: test_vget_lane_p8: + // CHECK-NEXT: umov.b w0, v0[7] + // CHECK-NEXT: ret + return vget_lane_p8(a, 7); +} + +poly16_t test_vget_lane_p16(poly16x4_t a) { + // CHECK-LABEL: test_vget_lane_p16: + // CHECK-NEXT: umov.h w0, v0[3] + // CHECK-NEXT: ret + return vget_lane_p16(a, 3); +} + +float32_t test_vget_lane_f32(float32x2_t a) { + // CHECK-LABEL: test_vget_lane_f32: + // CHECK-NEXT: mov s0, v0[1] + // CHECK-NEXT: ret + return vget_lane_f32(a, 1); +} + +float32_t test_vget_lane_f16(float16x4_t a) { + // CHECK-LABEL: test_vget_lane_f16: + // CHECK-NEXT: umov.h w8, v0[1] + // CHECK-NEXT: fmov s0, w8 + // CHECK-NEXT: fcvt s0, h0 + // CHECK-NEXT: ret + return vget_lane_f16(a, 1); +} + +uint8_t test_vgetq_lane_u8(uint8x16_t a) { + // CHECK-LABEL: test_vgetq_lane_u8: + // CHECK-NEXT: umov.b w0, v0[15] + // CHECK-NEXT: ret + return vgetq_lane_u8(a, 15); +} + +uint16_t test_vgetq_lane_u16(uint16x8_t a) { + // CHECK-LABEL: test_vgetq_lane_u16: + // CHECK-NEXT: umov.h w0, v0[7] + // CHECK-NEXT: ret + return vgetq_lane_u16(a, 7); +} + +uint32_t test_vgetq_lane_u32(uint32x4_t a) { + // CHECK-LABEL: test_vgetq_lane_u32: + // CHECK-NEXT: mov.s w0, v0[3] + // CHECK-NEXT: ret + return vgetq_lane_u32(a, 3); +} + +int8_t test_vgetq_lane_s8(int8x16_t a) { + // CHECK-LABEL: test_vgetq_lane_s8: + // CHECK-NEXT: umov.b w0, v0[15] + // CHECK-NEXT: ret + return vgetq_lane_s8(a, 15); +} + +int16_t test_vgetq_lane_s16(int16x8_t a) { + // CHECK-LABEL: test_vgetq_lane_s16: + // CHECK-NEXT: umov.h w0, v0[7] + // CHECK-NEXT: ret + return vgetq_lane_s16(a, 7); +} + +int32_t test_vgetq_lane_s32(int32x4_t a) { + // CHECK-LABEL: test_vgetq_lane_s32: + // CHECK-NEXT: mov.s w0, v0[3] + // CHECK-NEXT: ret + return vgetq_lane_s32(a, 3); +} + +poly8_t test_vgetq_lane_p8(poly8x16_t a) { + // CHECK-LABEL: test_vgetq_lane_p8: + // CHECK-NEXT: umov.b w0, v0[15] + // CHECK-NEXT: ret + return vgetq_lane_p8(a, 15); +} + +poly16_t test_vgetq_lane_p16(poly16x8_t a) { + // CHECK-LABEL: test_vgetq_lane_p16: + // CHECK-NEXT: umov.h w0, v0[7] + // CHECK-NEXT: ret + return vgetq_lane_p16(a, 7); +} + +float32_t test_vgetq_lane_f32(float32x4_t a) { + // CHECK-LABEL: test_vgetq_lane_f32: + // CHECK-NEXT: mov s0, v0[3] + // CHECK-NEXT: ret + return vgetq_lane_f32(a, 3); +} + +float32_t test_vgetq_lane_f16(float16x8_t a) { + // CHECK-LABEL: test_vgetq_lane_f16: + // CHECK-NEXT: umov.h w8, v0[3] + // CHECK-NEXT: fmov s0, w8 + // CHECK-NEXT: fcvt s0, h0 + // CHECK-NEXT: ret + return vgetq_lane_f16(a, 3); +} + +int64_t test_vget_lane_s64(int64x1_t a) { + // CHECK-LABEL: test_vget_lane_s64: + // CHECK-NEXT: fmov x0, d0 + // CHECK-NEXT: ret + return vget_lane_s64(a, 0); +} + +uint64_t test_vget_lane_u64(uint64x1_t a) { + // CHECK-LABEL: test_vget_lane_u64: + // CHECK-NEXT: fmov x0, d0 + // CHECK-NEXT: ret + return vget_lane_u64(a, 0); +} + +int64_t test_vgetq_lane_s64(int64x2_t a) { + // CHECK-LABEL: test_vgetq_lane_s64: + // CHECK-NEXT: mov.d x0, v0[1] + // CHECK-NEXT: ret + return vgetq_lane_s64(a, 1); +} + +uint64_t test_vgetq_lane_u64(uint64x2_t a) { + // CHECK-LABEL: test_vgetq_lane_u64: + // CHECK-NEXT: mov.d x0, v0[1] + // CHECK-NEXT: ret + return vgetq_lane_u64(a, 1); +} + + +uint8x8_t test_vset_lane_u8(uint8_t a, uint8x8_t b) { + // CHECK-LABEL: test_vset_lane_u8: + // CHECK-NEXT: ins.b v0[7], w0 + // CHECK-NEXT: ret + return vset_lane_u8(a, b, 7); +} + +uint16x4_t test_vset_lane_u16(uint16_t a, uint16x4_t b) { + // CHECK-LABEL: test_vset_lane_u16: + // CHECK-NEXT: ins.h v0[3], w0 + // CHECK-NEXT: ret + return vset_lane_u16(a, b, 3); +} + +uint32x2_t test_vset_lane_u32(uint32_t a, uint32x2_t b) { + // CHECK-LABEL: test_vset_lane_u32: + // CHECK-NEXT: ins.s v0[1], w0 + // CHECK-NEXT: ret + return vset_lane_u32(a, b, 1); +} + +int8x8_t test_vset_lane_s8(int8_t a, int8x8_t b) { + // CHECK-LABEL: test_vset_lane_s8: + // CHECK-NEXT: ins.b v0[7], w0 + // CHECK-NEXT: ret + return vset_lane_s8(a, b, 7); +} + +int16x4_t test_vset_lane_s16(int16_t a, int16x4_t b) { + // CHECK-LABEL: test_vset_lane_s16: + // CHECK-NEXT: ins.h v0[3], w0 + // CHECK-NEXT: ret + return vset_lane_s16(a, b, 3); +} + +int32x2_t test_vset_lane_s32(int32_t a, int32x2_t b) { + // CHECK-LABEL: test_vset_lane_s32: + // CHECK-NEXT: ins.s v0[1], w0 + // CHECK-NEXT: ret + return vset_lane_s32(a, b, 1); +} + +poly8x8_t test_vset_lane_p8(poly8_t a, poly8x8_t b) { + // CHECK-LABEL: test_vset_lane_p8: + // CHECK-NEXT: ins.b v0[7], w0 + // CHECK-NEXT: ret + return vset_lane_p8(a, b, 7); +} + +poly16x4_t test_vset_lane_p16(poly16_t a, poly16x4_t b) { + // CHECK-LABEL: test_vset_lane_p16: + // CHECK-NEXT: ins.h v0[3], w0 + // CHECK-NEXT: ret + return vset_lane_p16(a, b, 3); +} + +float32x2_t test_vset_lane_f32(float32_t a, float32x2_t b) { + // CHECK-LABEL: test_vset_lane_f32: + // CHECK-NEXT: ins.s v1[1], v0[0] + // CHECK-NEXT: mov.16b v0, v1 + // CHECK-NEXT: ret + return vset_lane_f32(a, b, 1); +} + +float16x4_t test_vset_lane_f16(float16_t *a, float16x4_t b) { + // CHECK-LABEL: test_vset_lane_f16: + // CHECK-NEXT: ld1.h { v0 }[3], [x0] + // CHECK-NEXT: ret + return vset_lane_f16(*a, b, 3); +} + +uint8x16_t test_vsetq_lane_u8(uint8_t a, uint8x16_t b) { + // CHECK-LABEL: test_vsetq_lane_u8: + // CHECK-NEXT: ins.b v0[15], w0 + // CHECK-NEXT: ret + return vsetq_lane_u8(a, b, 15); +} + +uint16x8_t test_vsetq_lane_u16(uint16_t a, uint16x8_t b) { + // CHECK-LABEL: test_vsetq_lane_u16: + // CHECK-NEXT: ins.h v0[7], w0 + // CHECK-NEXT: ret + return vsetq_lane_u16(a, b, 7); +} + +uint32x4_t test_vsetq_lane_u32(uint32_t a, uint32x4_t b) { + // CHECK-LABEL: test_vsetq_lane_u32: + // CHECK-NEXT: ins.s v0[3], w0 + // CHECK-NEXT: ret + return vsetq_lane_u32(a, b, 3); +} + +int8x16_t test_vsetq_lane_s8(int8_t a, int8x16_t b) { + // CHECK-LABEL: test_vsetq_lane_s8: + // CHECK-NEXT: ins.b v0[15], w0 + // CHECK-NEXT: ret + return vsetq_lane_s8(a, b, 15); +} + +int16x8_t test_vsetq_lane_s16(int16_t a, int16x8_t b) { + // CHECK-LABEL: test_vsetq_lane_s16: + // CHECK-NEXT: ins.h v0[7], w0 + // CHECK-NEXT: ret + return vsetq_lane_s16(a, b, 7); +} + +int32x4_t test_vsetq_lane_s32(int32_t a, int32x4_t b) { + // CHECK-LABEL: test_vsetq_lane_s32: + // CHECK-NEXT: ins.s v0[3], w0 + // CHECK-NEXT: ret + return vsetq_lane_s32(a, b, 3); +} + +poly8x16_t test_vsetq_lane_p8(poly8_t a, poly8x16_t b) { + // CHECK-LABEL: test_vsetq_lane_p8: + // CHECK-NEXT: ins.b v0[15], w0 + // CHECK-NEXT: ret + return vsetq_lane_p8(a, b, 15); +} + +poly16x8_t test_vsetq_lane_p16(poly16_t a, poly16x8_t b) { + // CHECK-LABEL: test_vsetq_lane_p16: + // CHECK-NEXT: ins.h v0[7], w0 + // CHECK-NEXT: ret + return vsetq_lane_p16(a, b, 7); +} + +float32x4_t test_vsetq_lane_f32(float32_t a, float32x4_t b) { + // CHECK-LABEL: test_vsetq_lane_f32: + // CHECK-NEXT: ins.s v1[3], v0[0] + // CHECK-NEXT: mov.16b v0, v1 + // CHECK-NEXT: ret + return vsetq_lane_f32(a, b, 3); +} + +float16x8_t test_vsetq_lane_f16(float16_t *a, float16x8_t b) { + // CHECK-LABEL: test_vsetq_lane_f16: + // CHECK-NEXT: ld1.h { v0 }[7], [x0] + // CHECK-NEXT: ret + return vsetq_lane_f16(*a, b, 7); +} + +int64x1_t test_vset_lane_s64(int64_t a, int64x1_t b) { + // CHECK-LABEL: test_vset_lane_s64: + // CHECK-NEXT: fmov d0, x0 + // CHECK-NEXT: ret + return vset_lane_s64(a, b, 0); +} + +uint64x1_t test_vset_lane_u64(uint64_t a, uint64x1_t b) { + // CHECK-LABEL: test_vset_lane_u64: + // CHECK-NEXT: fmov d0, x0 + // CHECK-NEXT: ret + return vset_lane_u64(a, b, 0); +} + +int64x2_t test_vsetq_lane_s64(int64_t a, int64x2_t b) { + // CHECK-LABEL: test_vsetq_lane_s64: + // CHECK-NEXT: ins.d v0[1], x0 + // CHECK-NEXT: ret + return vsetq_lane_s64(a, b, 1); +} + +uint64x2_t test_vsetq_lane_u64(uint64_t a, uint64x2_t b) { + // CHECK-LABEL: test_vsetq_lane_u64: + // CHECK-NEXT: ins.d v0[1], x0 + // CHECK-NEXT: ret + return vsetq_lane_u64(a, b, 1); +} diff --git a/test/CodeGen/arm64_vget.c b/test/CodeGen/arm64_vget.c deleted file mode 100644 index 62b68ef343..0000000000 --- a/test/CodeGen/arm64_vget.c +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: %clang_cc1 -O1 -triple arm64-apple-ios7 -target-feature +neon -ffreestanding -S -o - -emit-llvm %s | FileCheck %s -// Test ARM64 SIMD vget intrinsics - -#include - -float64_t test_vget_lane_f64(float64x1_t a1) { - // CHECK: test_vget_lane_f64 - // why isn't 1 allowed as second argument? - return vget_lane_f64(a1, 0); - // CHECK: extractelement {{.*}} i32 0 - // CHECK-NEXT: ret -} -