This is an archive of the discontinued LLVM Phabricator instance.

[ARM] 't' asm constraint should accept i32
ClosedPublic

Authored by kongyi on Nov 16 2017, 10:03 AM.

Details

Summary

't' constraint normally only accepts f32 operands, but for VCVT the operands can be i32. LLVM is overly restrictive and rejects asm like:

float foo() {
  float result;
  __asm__ __volatile__(
    "vcvt.f32.s32 %[result], %[arg1]\n"
    : [result]"=t"(result)
    : [arg1]"t"(0x01020304) );
  return result;
}

Relax the value type for 't' constraint to either f32 or i32.

Diff Detail

Repository
rL LLVM

Event Timeline

kongyi created this revision.Nov 16 2017, 10:03 AM
srhines edited edge metadata.Nov 16 2017, 10:10 AM

Thanks for addressing this.

test/CodeGen/ARM/inlineasm.ll
13 ↗(On Diff #123202)

constraint

efriedma added inline comments.
test/CodeGen/ARM/inlineasm.ll
14 ↗(On Diff #123202)

Pleas add some CHECK lines to this test so it's obvious the generated assembly is correct.

rengolin edited edge metadata.Nov 16 2017, 12:46 PM

Is the T constraint only used for movs?

Is the T constraint only used for movs?

t VFP floating-point registers s0-s31. Used for 32 bit values.
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints

kongyi updated this revision to Diff 123244.Nov 16 2017, 2:37 PM
kongyi marked 2 inline comments as done.
efriedma added inline comments.Nov 16 2017, 2:54 PM
test/CodeGen/ARM/inlineasm.ll
13 ↗(On Diff #123202)

Spelling is still wrong.

kongyi updated this revision to Diff 123245.Nov 16 2017, 2:57 PM
This revision is now accepted and ready to land.Nov 16 2017, 3:13 PM
This revision was automatically updated to reflect the committed changes.