This is an archive of the discontinued LLVM Phabricator instance.

Fix for PR18921.
ClosedPublic

Authored by dyatkovskiy on Apr 3 2014, 6:16 AM.

Details

Summary

Please review fix for PR18921.

Diff Detail

Event Timeline

As summary (sorry, I'm still new with it):
Fix for PR18921:
Added GNU Assembler compatiblity definitions for post/pre increments in ARMInstrInfo.td.
Added GNU Assembler compatiblity definitions for thumb2: ARMInstrThumb2.td.
Fixed ARMAsmParser::ParseInstruction GNU compatability branch, so it also works for thumb mode from now.

Hi Stepan,

I don't think the changes to the .td files are needed: basically there's no way for the parser to create a GPRPair operand so the definitions will never trigger.

If I completely remove your changes to .td files, your tests still pass.

If you are convinced, could I ask you to remove the existing LDRD GNU hacks from the .td while you're there?

Cheers.

Tim

One of the issues in the bug report is that ldrd/strd in Thumb mode accepts the offset up to 1020 (in multiples of 4), and in ARM only 0-255, so not only the encoding is different, but the ranges are different.

I'm assuming this should be supported somewhere else, but would be good to add some of the tests from the bug just to show that they are now accepted.

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
5410

can you add tests for both formats?

5419

can you add a negative test for this?

I don't think the changes to the .td files are needed: basically there's no way for the parser to create a GPRPair operand so the definitions will never trigger.

Yup, they likely won't. I'll do it then tomorrow.

ldrd/strd in Thumb mode accepts the offset up to 1020 (in multiples of 4)

Is it what test/MC/ARM/ldrd-strd-gnu-arm-bad-imm.s checks? Anyway I'll recheck the reference.

Thanks for review guys! I'll publish fix tomorrow. Its time to sleep now :-)

dyatkovskiy updated this revision to Unknown Object (????).Apr 4 2014, 2:22 AM

Removed "GNU Assembler extension (compatibility)" definitions from ARMInstrInfo.td and ARMInstrThumb2.td
Updated tests.

I see no NL at EOF in test/MC/ARM/ldrd-strd-gnu-arm-bad-imm.s. That will fixed in commit.
Renato,
non gnu ldrd/strd has tests already, so if, in you first inline comment you meant
ldrd r0, r1, [r2, #123]
Then it already tested in arm-ldrd.s, arm-memory-instructions.s, basic-thumb2-instructions.s.

negative tests

Yes, we have ldrd-strd-gnu-thumb-bad-regs.s test for it.

rengolin accepted this revision.Apr 4 2014, 2:42 AM

Thanks! LGTM

r205622.
Though it is only first part of PR18921. We also have to deal with vmov.i32 instruction.

And thank you for fast reviews!