Changeset View
Changeset View
Standalone View
Standalone View
clang/test/CodeGen/riscv32-ilp32-ilp32f-abi.c
// RUN: %clang_cc1 -triple riscv32 -emit-llvm %s -o - | FileCheck %s | // RUN: %clang_cc1 -triple riscv32 -emit-llvm %s -o - | FileCheck %s | ||||
// RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-abi ilp32f -emit-llvm %s -o - \ | |||||
// RUN: | FileCheck %s | |||||
// This file contains test cases that will have the same output for the ilp32 | // This file contains test cases that will have the same output for the ilp32 | ||||
// and ilp32f ABIs. | // and ilp32f ABIs. | ||||
#include <stddef.h> | #include <stddef.h> | ||||
#include <stdint.h> | #include <stdint.h> | ||||
struct tiny { | struct tiny { | ||||
Show All 20 Lines | int f_scalar_stack_1(int32_t a, int64_t b, int32_t c, double d, long double e, | ||||
uint8_t f, int8_t g, uint8_t h) { | uint8_t f, int8_t g, uint8_t h) { | ||||
return g + h; | return g + h; | ||||
} | } | ||||
// Ensure that scalars passed on the stack are still determined correctly in | // Ensure that scalars passed on the stack are still determined correctly in | ||||
// the presence of large return values that consume a register due to the need | // the presence of large return values that consume a register due to the need | ||||
// to pass a pointer. | // to pass a pointer. | ||||
// CHECK-LABEL: define void @f_scalar_stack_2(%struct.large* noalias sret %agg.result, i32 %a, i64 %b, i64 %c, fp128 %d, i8 zeroext %e, i8 %f, i8 %g) | // CHECK-LABEL: define void @f_scalar_stack_2(%struct.large* noalias sret %agg.result, i32 %a, i64 %b, double %c, fp128 %d, i8 zeroext %e, i8 %f, i8 %g) | ||||
struct large f_scalar_stack_2(int32_t a, int64_t b, int64_t c, long double d, | struct large f_scalar_stack_2(int32_t a, int64_t b, double c, long double d, | ||||
uint8_t e, int8_t f, uint8_t g) { | uint8_t e, int8_t f, uint8_t g) { | ||||
return (struct large){a, e, f, g}; | return (struct large){a, e, f, g}; | ||||
} | } | ||||
// Aggregates and >=XLen scalars passed on the stack should be lowered just as | // Aggregates and >=XLen scalars passed on the stack should be lowered just as | ||||
// they would be if passed via registers. | // they would be if passed via registers. | ||||
// CHECK-LABEL: define void @f_scalar_stack_3(double %a, i64 %b, double %c, i64 %d, i32 %e, i64 %f, i32 %g, double %h, fp128 %i) | // CHECK-LABEL: define void @f_scalar_stack_3(double %a, i64 %b, double %c, i64 %d, i32 %e, i64 %f, i32 %g, double %h, fp128 %i) | ||||
void f_scalar_stack_3(double a, int64_t b, double c, int64_t d, int e, | void f_scalar_stack_3(double a, int64_t b, double c, int64_t d, int e, | ||||
int64_t f, int32_t g, double h, long double i) {} | int64_t f, int32_t g, double h, long double i) {} | ||||
// CHECK-LABEL: define void @f_agg_stack(double %a, i64 %b, double %c, i64 %d, i32 %e.coerce, [2 x i32] %f.coerce, i64 %g.coerce, %struct.large* %h) | // CHECK-LABEL: define void @f_agg_stack(double %a, i64 %b, double %c, i64 %d, i32 %e.coerce, [2 x i32] %f.coerce, i64 %g.coerce, %struct.large* %h) | ||||
void f_agg_stack(double a, int64_t b, double c, int64_t d, struct tiny e, | void f_agg_stack(double a, int64_t b, double c, int64_t d, struct tiny e, | ||||
struct small f, struct small_aligned g, struct large h) {} | struct small f, struct small_aligned g, struct large h) {} |