[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / RISCV / riscv32-ilp32-abi.c
blob9b157ad5c782ec8cc83390835c7c66e7f6235ff8
1 // RUN: %clang_cc1 -triple riscv32 -emit-llvm %s -o - | FileCheck %s
3 // This file contains test cases that will have different output for ilp32 vs
4 // the other 32-bit ABIs.
6 #include <stddef.h>
7 #include <stdint.h>
9 struct tiny {
10 uint8_t a, b, c, d;
13 struct small {
14 int32_t a, *b;
17 struct small_aligned {
18 int64_t a;
21 struct large {
22 int32_t a, b, c, d;
25 // Scalars passed on the stack should have signext/zeroext attributes, just as
26 // if they were passed in registers.
28 // CHECK-LABEL: define{{.*}} i32 @f_scalar_stack_1(i32 noundef %a, i64 noundef %b, float noundef %c, double noundef %d, fp128 noundef %e, i8 noundef zeroext %f, i8 noundef signext %g, i8 noundef zeroext %h)
29 int f_scalar_stack_1(int32_t a, int64_t b, float c, double d, long double e,
30 uint8_t f, int8_t g, uint8_t h) {
31 return g + h;
34 // CHECK-LABEL: define{{.*}} void @f_scalar_stack_2(ptr noalias sret(%struct.large) align 4 %agg.result, float noundef %a, i64 noundef %b, double noundef %c, fp128 noundef %d, i8 noundef zeroext %e, i8 noundef signext %f, i8 noundef zeroext %g)
35 struct large f_scalar_stack_2(float a, int64_t b, double c, long double d,
36 uint8_t e, int8_t f, uint8_t g) {
37 return (struct large){a, e, f, g};
40 // Aggregates and >=XLen scalars passed on the stack should be lowered just as
41 // they would be if passed via registers.
43 // CHECK-LABEL: define{{.*}} void @f_scalar_stack_3(double noundef %a, i64 noundef %b, double noundef %c, i64 noundef %d, i32 noundef %e, i64 noundef %f, float noundef %g, double noundef %h, fp128 noundef %i)
44 void f_scalar_stack_3(double a, int64_t b, double c, int64_t d, int e,
45 int64_t f, float g, double h, long double i) {}
47 // CHECK-LABEL: define{{.*}} void @f_agg_stack(double noundef %a, i64 noundef %b, double noundef %c, i64 noundef %d, i32 %e.coerce, [2 x i32] %f.coerce, i64 %g.coerce, ptr noundef %h)
48 void f_agg_stack(double a, int64_t b, double c, int64_t d, struct tiny e,
49 struct small f, struct small_aligned g, struct large h) {}