diff --git a/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/neonintrn-1.c b/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/neonintrn-1.c new file mode 100644 index 0000000000000000000000000000000000000000..2bb909a0552dc30fbcd1ae44685510dfee682fe3 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/neonintrn-1.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include "arm_neon.h" +#include +#include + +uint32x4_t foo(void *p) { + uint16x8_t u16 = vld1q_u16(p); + return vpaddlq_u16(u16); +} + +uint16_t foo2(void *p) { + uint16x8_t u16 = vld1q_u16(p); + return vaddvq_u16(u16); +} + +int main() +{ + char s[] = {1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4}; + uint32x4_t f1 = foo( &s ); + uint32_t t1, t2, t3, t4; + t1 = vgetq_lane_u32(f1, 0); + // printf("t0: 0x%x\n", t1); + t2 = vgetq_lane_u32(f1, 1); + // printf("t1: 0x%x\n", t2); + t3 = vgetq_lane_u32(f1, 2); + // printf("t2: 0x%x\n", t3); + t4 = vgetq_lane_u32(f1, 3); + // printf("t3: 0x%x\n", t4); + if (t1 != 0x202 || t2 != 0x404 || t3 != 0x606 | t4 != 0x808) + abort(); + + // printf("-- Test 2: --\n"); + uint16_t f2 = foo2( &s ); + // printf("f2: %d\n", f2); + if (f2 != 0x1414) + abort(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/test.cfg b/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..8995744433b5dfff6c5995570fe99b321f56ed27 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0028-neonintrn-1/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-1) +run(neonintrn-1) diff --git a/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/neonintrn-2.c b/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/neonintrn-2.c new file mode 100644 index 0000000000000000000000000000000000000000..1fd7deaad86a5eedc0eb3db5b99efd7e4a1b0146 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/neonintrn-2.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include "arm_neon.h" +#include +#include + +uint8x16_t foo(void *p) { + uint8x16_t u1 = vld1q_u8(p); + uint8x16_t u2 = vrev32q_u8(u1); /* reverse */ + return vextq_u8(u1, u2, 8); /* merge at 8 */ +} + +int main() +{ + char s[] = {1,1,2,2, 3,3,4,4, 5,5,6,6, 7,7,8,8}; + uint8x16_t f2 = foo( &s ); + long u8m[2]; + vst1q_u8((void*)&u8m, f2); + // printf("f2: 0x%lx,0x%lx\n", u8m[0], u8m[1]); + if (u8m[0] != 0x808070706060505 || u8m[1] != 0x303040401010202) + abort(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/test.cfg b/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..1d98d2e174824073b351c0b7290747769ae67ca1 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0029-neonintrn-2/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-2) +run(neonintrn-2) diff --git a/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/neonintrn-3.c b/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/neonintrn-3.c new file mode 100644 index 0000000000000000000000000000000000000000..d24ed9943e7474adc764a00636139d3b01e8bc5f --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/neonintrn-3.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include "arm_neon.h" +#include +#include + +uint32_t foo(void *p) { + uint32x4_t u1 = vld1q_u32(p); + uint32_t uit = vgetq_lane_u32(u1, 3); + unsigned int ui = uit; + if (ui != 4) + abort(); + return uit; +} + +int main() +{ + unsigned int s[] = {1, 2, 3, 4}; + uint32_t ui = foo( &s ); + uint32x4_t t = {1, 1, 1, 1}; + t = vsetq_lane_u32(ui, t, 3); + ui = vgetq_lane_u32(t, 1); + if (ui != 1) + abort(); + if (vgetq_lane_u32(t, 3) != 4) + abort(); + // printf("t: 0x%x 0x%x\n", ui, vgetq_lane_u32(t, 3)); +} diff --git a/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/test.cfg b/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..47c5075f3dc75237df4034ecf08c36be649c31f0 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0030-neonintrn-3/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-3) +run(neonintrn-3) diff --git a/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/neonintrn-4.c b/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/neonintrn-4.c new file mode 100644 index 0000000000000000000000000000000000000000..033acf3deeb22c0501fb8a06d4a3784a1c5d6f5b --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/neonintrn-4.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include "arm_neon.h" +#include +#include + +int32x4_t foo1(void *p) { + return vandq_s32( vld1q_s32(p), vdupq_n_s32(3)); +} + +uint16x8_t foo2(void *p, void *q) { + return vandq_u16( vld1q_u16(p), vld1q_u16(q)); +} + +int main() +{ + int s[] = {7,7,7,7}; + int32x4_t r = foo1( &s ); + int t[4]; + vst1q_s32((void*)&t, r); + // printf("r: %x %x %x %x\n", t[0], t[1], t[2], t[3]); + if (t[0] != 3 || t[1] != 3 || t[2] != 3 || t[3] != 3) + abort(); + + // printf("-- Test 4b: uint16x8_t --\n"); + unsigned short s2[] = {7,7,7,7,7,7,7,7}; + unsigned short t2[] = {3,3,3,3,3,3,3,3}; + uint32x4_t r2 = vpaddlq_u16( foo2( &s2, &t2 ) ); + // printf("r2: %x %x %x %x\n", + // vgetq_lane_u32(r2, 0), + // vgetq_lane_u32(r2, 1), + // vgetq_lane_u32(r2, 2), + // vgetq_lane_u32(r2, 0)); + if (vgetq_lane_u32(r2, 0) != 6 || + vgetq_lane_u32(r2, 1) != 6 || + vgetq_lane_u32(r2, 2) != 6 || + vgetq_lane_u32(r2, 0) != 6) + abort(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/test.cfg b/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..cc97ff45384553e96263fa0d7a0ac192e6c40ba8 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0031-neonintrn-4/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-4) +run(neonintrn-4) diff --git a/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/neonintrn-5.c b/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/neonintrn-5.c new file mode 100644 index 0000000000000000000000000000000000000000..d6a299f6ac12ef182f0505d08828c8f659959087 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/neonintrn-5.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ +#include "arm_neon.h" +#include +#include + +uint16x8_t foo(uint16x8_t p1, uint16x8_t p2) +{ + return vceqq_u16(p1, p2); +} + +int main() +{ + unsigned short s1[] = { 10, 20, 30, 40, 1, 2, 3, 4 }; + unsigned short s2[] = { 10, 20, 30, 41, 1, 2, 3, 3 }; + + uint16x8_t a = vld1q_u16((void*)&s1); + uint16x8_t b = vld1q_u16((void*)&s2); + uint16x8_t x = foo(a, b); + unsigned s = vgetq_lane_u16(x, 3) + vgetq_lane_u16(x, 7); + // printf("s = 0x%x\n", s); + if (s != 0 ) + abort(); + + s = vgetq_lane_u16(x, 0); + // printf("s = 0x%x\n", s); + if (s != 0xffff) + abort(); + + int16x8_t c = { 1, 1, 1, 1, 2, 2, 2, 2 }; + if (vgetq_lane_u16( vshlq_u16(a, c), 2) != 60) + abort(); + + if (vgetq_lane_u16( vshlq_u16(a, c), 7) != 16) + abort(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/test.cfg b/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..d04156b0ecf34d1b55df735f5a06d28e2c07d87a --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0032-neonintrn-5/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-5) +run(neonintrn-5) diff --git a/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/neonintrn-6.c b/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/neonintrn-6.c new file mode 100644 index 0000000000000000000000000000000000000000..eaa326e6a1a2d05d6f815ede9753ee5325303df7 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/neonintrn-6.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) [2021] Futurewei Technologies, Inc. All rights reverved. + * + * Licensed under the Mulan Permissive Software License v2. + * You can use this software according to the terms and conditions of the MulanPSL - 2.0. + * You may obtain a copy of MulanPSL - 2.0 at: + * + * https://opensource.org/licenses/MulanPSL-2.0 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR + * FIT FOR A PARTICULAR PURPOSE. + * See the MulanPSL - 2.0 for more details. + */ + +#include "arm_neon.h" +#include +#include +#include + +int main() +{ + char s[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + uint8x16_t p = vld1q_u8((void*)s); + uint8x16_t idx = vrev32q_u8(p); + char r[17] = {0}; + uint8x16_t x; + + x = vqtbl1q_u8(p, idx); // reverse + vst1q_u8((void*)r, x); + //printf("r = %s\n", r); + char answer[] = {5, 4, 3, 2, 9, 8, 7, 6, 13, 12, 11, 10, 0, 16, 15, 14}; + if (memcmp(r, answer, 16)) + abort(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/test.cfg b/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..2a119fa6b586aec585129384c626cd79a31bcc41 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0033-neonintrn-6/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrn-6) +run(neonintrn-6) diff --git a/testsuite/driver/src/mode/CO2.py b/testsuite/driver/src/mode/CO2.py index b191ba1d1b92f2e3aee15f8083ae0df4846a92ad..cbbb2c9471a51a50589768d93d6eec3e60c2d20d 100644 --- a/testsuite/driver/src/mode/CO2.py +++ b/testsuite/driver/src/mode/CO2.py @@ -26,9 +26,10 @@ CO2 = { ), Maple( maple="${OUT_ROOT}/${MAPLE_BUILD_TYPE}/bin/maple", - run=["mplcg"], + run=["me", "mplcg"], option={ - "mplcg": "-O2 --quiet" + "me": "--O2 --quiet", + "mplcg": "--O2 --quiet" }, global_option="", infile="${APP}.mpl"