Files
clang-p2996/clang/test/CodeGen/Mips/inline-asm-constraints.c
YunQiang Su c88beb4112 MIPS: Fix asm constraints "f" and "r" for softfloat (#79116)
This include 2 fixes:
        1. Disallow 'f' for softfloat.
        2. Allow 'r' for softfloat.

Currently, 'f' is accpeted by clang, then LLVM meets an internal error.

'r' is rejected by LLVM by: couldn't allocate input reg for constraint
'r'.

Fixes: #64241, #63632

---------

Co-authored-by: Fangrui Song <i@maskray.me>
2024-02-26 22:08:36 -08:00

12 lines
364 B
C

// RUN: %clang_cc1 -emit-llvm -triple mips -target-feature +soft-float %s -o - | FileCheck %s --check-prefix=SOFT_FLOAT
// SOFT_FLOAT: call void asm sideeffect "", "r,~{$1}"(float %1)
void read_float(float *p) {
__asm__("" ::"r"(*p));
}
// SOFT_FLOAT: call void asm sideeffect "", "r,~{$1}"(double %1)
void read_double(double *p) {
__asm__("" :: "r"(*p));
}