xref: /aosp_15_r20/external/clang/test/CodeGenCXX/poly-unsigned.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -triple arm64-apple-ios -target-feature +neon -ffreestanding -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-UNSIGNED-POLY %s
2*67e74705SXin Li // RUN: %clang_cc1 -triple arm64-linux-gnu -target-feature +neon -ffreestanding -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-UNSIGNED-POLY %s
3*67e74705SXin Li // RUN: %clang_cc1 -triple armv7-apple-ios -ffreestanding -target-cpu cortex-a8 -S -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-SIGNED-POLY %s
4*67e74705SXin Li 
5*67e74705SXin Li #include <arm_neon.h>
6*67e74705SXin Li 
7*67e74705SXin Li // Polynomial types really should be universally unsigned, otherwise casting
8*67e74705SXin Li // (say) poly8_t "x^7" to poly16_t would change it to "x^15 + x^14 + ... +
9*67e74705SXin Li // x^7". Unfortunately 32-bit ARM ended up in a slightly delicate ABI situation
10*67e74705SXin Li // so for now it got that wrong.
11*67e74705SXin Li 
test_poly8(poly8_t pIn)12*67e74705SXin Li poly16_t test_poly8(poly8_t pIn) {
13*67e74705SXin Li // CHECK-UNSIGNED-POLY: @_Z10test_poly8h
14*67e74705SXin Li // CHECK-UNSIGNED-POLY: zext i8 {{.*}} to i16
15*67e74705SXin Li 
16*67e74705SXin Li // CHECK-SIGNED-POLY: @_Z10test_poly8a
17*67e74705SXin Li // CHECK-SIGNED-POLY: sext i8 {{.*}} to i16
18*67e74705SXin Li 
19*67e74705SXin Li   return pIn;
20*67e74705SXin Li }
21