98 lines · c
1/// Check that ABI is correctly implemented.2///3/// 1. Check that all integer arguments and return values less than 64 bits4/// are sign/zero extended.5/// 2. Check that all complex arguments and return values are placed in6/// registers if it is possible. Not treat it as aggregate.7/// 3. Check that a function declared without argument type declarations is8/// treated as VARARGS (in order to place arguments in both registers and9/// memory locations in the back end)10 11// RUN: %clang_cc1 -triple ve-linux-gnu -emit-llvm -Wno-strict-prototypes %s -o - | FileCheck %s12 13// CHECK-LABEL: define{{.*}} signext i8 @fun_si8(i8 noundef signext %a, i8 noundef signext %b) #0 {14char fun_si8(char a, char b) {15 return a;16}17 18// CHECK-LABEL: define{{.*}} zeroext i8 @fun_zi8(i8 noundef zeroext %a, i8 noundef zeroext %b) #0 {19unsigned char fun_zi8(unsigned char a, unsigned char b) {20 return a;21}22 23// CHECK-LABEL: define{{.*}} signext i16 @fun_si16(i16 noundef signext %a, i16 noundef signext %b) #0 {24short fun_si16(short a, short b) {25 return a;26}27 28// CHECK-LABEL: define{{.*}} zeroext i16 @fun_zi16(i16 noundef zeroext %a, i16 noundef zeroext %b) #0 {29unsigned short fun_zi16(unsigned short a, unsigned short b) {30 return a;31}32 33// CHECK-LABEL: define{{.*}} signext i32 @fun_si32(i32 noundef signext %a, i32 noundef signext %b) #0 {34int fun_si32(int a, int b) {35 return a;36}37 38// CHECK-LABEL: define{{.*}} zeroext i32 @fun_zi32(i32 noundef zeroext %a, i32 noundef zeroext %b) #0 {39unsigned int fun_zi32(unsigned int a, unsigned int b) {40 return a;41}42 43// CHECK-LABEL: define{{.*}} i64 @fun_si64(i64 noundef %a, i64 noundef %b) #0 {44long fun_si64(long a, long b) {45 return a;46}47 48// CHECK-LABEL: define{{.*}} i64 @fun_zi64(i64 noundef %a, i64 noundef %b) #0 {49unsigned long fun_zi64(unsigned long a, unsigned long b) {50 return a;51}52 53// CHECK-LABEL: define{{.*}} i128 @fun_si128(i128 noundef %a, i128 noundef %b) #0 {54__int128 fun_si128(__int128 a, __int128 b) {55 return a;56}57 58// CHECK-LABEL: define{{.*}} i128 @fun_zi128(i128 noundef %a, i128 noundef %b) #0 {59unsigned __int128 fun_zi128(unsigned __int128 a, unsigned __int128 b) {60 return a;61}62 63// CHECK-LABEL: define{{.*}} float @fun_float(float noundef %a, float noundef %b) #0 {64float fun_float(float a, float b) {65 return a;66}67 68// CHECK-LABEL: define{{.*}} double @fun_double(double noundef %a, double noundef %b) #0 {69double fun_double(double a, double b) {70 return a;71}72 73// CHECK-LABEL: define{{.*}} fp128 @fun_quad(fp128 noundef %a, fp128 noundef %b) #0 {74long double fun_quad(long double a, long double b) {75 return a;76}77 78// CHECK-LABEL: define{{.*}} { float, float } @fun_fcomplex(float noundef %a.coerce0, float noundef %a.coerce1, float noundef %b.coerce0, float noundef %b.coerce1) #0 {79float __complex__ fun_fcomplex(float __complex__ a, float __complex__ b) {80 return a;81}82 83// CHECK-LABEL: define{{.*}} { double, double } @fun_dcomplex(double noundef %a.coerce0, double noundef %a.coerce1, double noundef %b.coerce0, double noundef %b.coerce1) #0 {84double __complex__ fun_dcomplex(double __complex__ a, double __complex__ b) {85 return a;86}87 88// CHECK-LABEL: define{{.*}} { fp128, fp128 } @fun_qcomplex(fp128 noundef %a.coerce0, fp128 noundef %a.coerce1, fp128 noundef %b.coerce0, fp128 noundef %b.coerce1) #0 {89long double __complex__ fun_qcomplex(long double __complex__ a, long double __complex__ b) {90 return a;91}92 93extern int hoge();94void func(void) {95 // CHECK: %call = call signext i32 (i32, i32, i32, i32, i32, i32, i32, ...) @hoge(i32 noundef signext 1, i32 noundef signext 2, i32 noundef signext 3, i32 noundef signext 4, i32 noundef signext 5, i32 noundef signext 6, i32 noundef signext 7)96 hoge(1, 2, 3, 4, 5, 6, 7);97}98