LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 4687 - arm10tdmi (armv5) does not support strd
Summary: arm10tdmi (armv5) does not support strd
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: ARM (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-05 22:08 PDT by Nick Lewycky
Modified: 2009-09-29 02:08 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments
testcase (516 bytes, application/octet-stream)
2009-08-05 22:08 PDT, Nick Lewycky
Details
ARMPreAllocLoadStoreOpt::CanFormLdStDWord() should return false for pre-ARM v5TE architectures (650 bytes, patch)
2009-09-27 15:12 PDT, John Tytgat
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2009-08-05 22:08:00 PDT
Created attachment 3289 [details]
testcase

LLVM is emitting bad assembly for the attached testcase:

$ llc -O2 -mcpu=arm10tdmi x.bc -o - | grep cpu
        .cpu arm10tdmi
$ llc -O2 -mcpu=arm10tdmi x.bc -o - | grep strd
        strd r0, [r6]
        strd r0, [r6, #+8]
$ llc -O2 -mcpu=arm10tdmi x.bc -o - | as
{standard input}: Assembler messages:
{standard input}:545: Error: selected processor does not support `strd r0,[r6]'
{standard input}:551: Error: selected processor does not support `strd r0,[r6,#+8]'

Apparently ARMv5 is too old for the 'strd' instruction. (Or perhaps my binutils just thinks it is.)
Comment 1 Misha Brukman 2009-08-19 11:08:39 PDT
The problem is that ArmInstrInfo.td defines STRD as requiring HasV5T whereas it should require HasV5TE.  LDRD has the same bug.

Research:

* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0135a/ch01s02s01.html

"ARM1020T is built around the ARM10TDMI processor unit. This is an ARMv5T implementation ..."

* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dvi0014a/ar01s04.html

ARMv5T has no STRD -- it only has STR, STRH, and STRB.  Same for LDRD.

* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/18564.html

"Architecture v5TE and later processors provide LDRD and STRD instructions to load/store 64-bit data, ..."
Comment 2 Misha Brukman 2009-08-19 11:52:33 PDT
Changing as I described above makes the test case not output STRD, but only if I also remove the line

target triple = "armv5-unknown-linux-gnueabi"

from the .ll file and recompile.  Leaving it there overrides my command-line -mcpu flag and still generates STRD instructions while also printing out the line

.cpu arm10tdmi

which is contradictory.

So, while we should just fix the STRD and LDRD definitions, there's another bug here.
Comment 3 Misha Brukman 2009-08-27 09:15:00 PDT
STRD and LDRD instruction definitions fixed in r80244, the other issue still remains.
Comment 4 John Tytgat 2009-09-27 15:12:52 PDT
Created attachment 3573 [details]
ARMPreAllocLoadStoreOpt::CanFormLdStDWord() should return false for pre-ARM v5TE architectures
Comment 5 John Tytgat 2009-09-27 15:15:09 PDT
I believe I've just bumped in the remainder of this bug, i.e. ldrd/strd instructions were still generated despite having selected a pre-ARM v5TE architecture.  I've created a simple patch for ARMPreAllocLoadStoreOpt::CanFormLdStDWord() which fixes my problem.
Comment 6 Evan Cheng 2009-09-29 02:08:33 PDT
Thanks. I've applied the patch.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090928/088107.html