diff --git a/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/expected.txt b/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/neonintrin-01.c b/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/neonintrin-01.c new file mode 100644 index 0000000000000000000000000000000000000000..2bb909a0552dc30fbcd1ae44685510dfee682fe3 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/neonintrin-01.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-neonintrin-01/test.cfg b/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c2c7ccec4be7548dc0b8eb6a64858a956dca8347 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0028-neonintrin-01/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-01) +run(neonintrin-01) diff --git a/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/expected.txt b/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/neonintrin-02.c b/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/neonintrin-02.c new file mode 100644 index 0000000000000000000000000000000000000000..1fd7deaad86a5eedc0eb3db5b99efd7e4a1b0146 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/neonintrin-02.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-neonintrin-02/test.cfg b/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..e367975b20e85610e540fb67ad4d7da28992a6c9 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0029-neonintrin-02/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-02) +run(neonintrin-02) diff --git a/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/expected.txt b/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/neonintrin-03.c b/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/neonintrin-03.c new file mode 100644 index 0000000000000000000000000000000000000000..d24ed9943e7474adc764a00636139d3b01e8bc5f --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/neonintrin-03.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-neonintrin-03/test.cfg b/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..11b93663b809522c8bd3f6599cb472bd2047e56a --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0030-neonintrin-03/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-03) +run(neonintrin-03) diff --git a/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/expected.txt b/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/neonintrin-05.c b/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/neonintrin-05.c new file mode 100644 index 0000000000000000000000000000000000000000..d6a299f6ac12ef182f0505d08828c8f659959087 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/neonintrin-05.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-neonintrin-05/test.cfg b/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..6477195607736b8a7d6f98d7ae9f64da881d1bb3 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0032-neonintrin-05/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-05) +run(neonintrin-05) diff --git a/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/expected.txt b/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/neonintrin-06.c b/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/neonintrin-06.c new file mode 100644 index 0000000000000000000000000000000000000000..eaa326e6a1a2d05d6f815ede9753ee5325303df7 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/neonintrin-06.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-neonintrin-06/test.cfg b/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..36c33b04289d5a50b8b2e12efee71a98e957065f --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0033-neonintrin-06/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-06) +run(neonintrin-06) diff --git a/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/expected.txt b/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/neonintrin-07.c b/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/neonintrin-07.c new file mode 100644 index 0000000000000000000000000000000000000000..13959362667caa0b75fb7c509a0a93ad4c34a7ee --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/neonintrin-07.c @@ -0,0 +1,79 @@ +/* + * 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 + +void foo1() +{ + uint32x2_t c = {1,1}; + + uint8x16_t x = vdupq_n_u8(10); + uint64x2_t y = vreinterpretq_u64_u8(x); + uint64x2_t z = vmlal_u32(y, c, vdup_n_u32(1)); + uint32x4_t r = vreinterpretq_u32_u64(z); + //printf("r: 0x%x 0x%x 0x%x 0x%x\n", vgetq_lane_u32(r, 0), vgetq_lane_u32(r, 1), + // vgetq_lane_u32(r, 2), vgetq_lane_u32(r, 3)); + // printf("z = 0x%lx, 0x%lx\n", vget_high_u64(z), vget_low_u64(z)); + if (vgetq_lane_u32(r, 0) != 0xa0a0a0b || vgetq_lane_u32(r, 1) != 0xa0a0a0a || + vgetq_lane_u32(r, 2) != 0xa0a0a0b || vgetq_lane_u32(r, 3) != 0xa0a0a0a) + abort(); +} + +void foo2() { + uint64x2_t x = { 2, 4 }; + uint32x4_t zero = { 0, 0, 0, 0 }; + uint32x4_t r = veorq_u32( vreinterpretq_u32_u64(x), zero ); + if (vgetq_lane_u32(r, 0) != 2) + abort(); + if (vgetq_lane_u32(r, 1) != 0) + abort(); + if (vgetq_lane_u32(r, 2) != 4) + abort(); + if (vgetq_lane_u32(r, 3) != 0) + abort(); +} + +void foo3() { + uint64x2_t x = { 2, 4 }; + uint64x2_t zero = { 0, 0 }; + uint32x4_t r = vreinterpretq_u32_u64( veorq_u64( x, zero ) ); + if (vgetq_lane_u32(r, 0) != 2) + abort(); + if (vgetq_lane_u32(r, 1) != 0) + abort(); + if (vgetq_lane_u32(r, 2) != 4) + abort(); + if (vgetq_lane_u32(r, 3) != 0) + abort(); +} + +void foo4() { + uint32x2_t a = {1, 0}; + uint32x2_t b = vdup_n_u32(10); + uint32x4_t r = vreinterpretq_u32_u64( vmull_u32(a, b) ); + if (vgetq_lane_u32(r, 0) != 0xa || vgetq_lane_u32(r, 1) != 0 || + vgetq_lane_u32(r, 2) != 0 || vgetq_lane_u32(r, 3) != 0) + abort(); +} + +int main() +{ + foo1(); + foo2(); + foo3(); + foo4(); +} diff --git a/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/test.cfg b/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/test.cfg new file mode 100644 index 0000000000000000000000000000000000000000..85d7c1ae720fa8fb6f7e42561ff41d937d85a754 --- /dev/null +++ b/testsuite/c_test/sanity_test/SANITY0034-neonintrin-07/test.cfg @@ -0,0 +1,3 @@ +clean() +compile(neonintrin-07) +run(neonintrin-07) diff --git a/testsuite/driver/src/mode/CO2.py b/testsuite/driver/src/mode/CO2.py index 325e3f582c27d52438448a41969ac983330a345d..f70ef475a150e331ead6bad402949008200bb984 100644 --- a/testsuite/driver/src/mode/CO2.py +++ b/testsuite/driver/src/mode/CO2.py @@ -26,8 +26,9 @@ CO2 = { ), Maple( maple="${OUT_ROOT}/${MAPLE_BUILD_TYPE}/bin/maple", - run=["mplcg"], + run=["me","mplcg"], option={ + "me": "-O2 --quiet", "mplcg": "-O2 --quiet" }, global_option="", @@ -43,14 +44,14 @@ CO2 = { "run": [ QemuRun( qemu_libc=[ - "${MAPLE_ROOT}/tools/gcc-linaro-7.5.0/aarch64-linux-gnu/libc" + "${MAPLE_ROOT}/tools/gcc-linaro-7.5.0/aarch64-linux-gnu/libc" ], infile="${APP}.out", - redirection="output.log" + redirection="output.log" ), CheckFileEqual( file1="output.log", - file2="expected.txt" + file2="expected.txt" ) ] }