[ARM] Do not select SMULW[BT] or SMLAW[BT]
authorOliver Stannard <oliver.stannard@arm.com>
Mon, 20 Oct 2014 11:30:35 +0000 (11:30 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Mon, 20 Oct 2014 11:30:35 +0000 (11:30 +0000)
commite8f63a54b48a6bb770abe918fa3ef8f3413b8091
treebc340923ee251f2af10c6923f7e5b1f69830ebd8
parent86296e36d70c585c0e8a905da1d3546c51d1a121
[ARM] Do not select SMULW[BT] or SMLAW[BT]

The current instruction selection patterns for SMULW[BT] and SMLAW[BT]
are incorrect. These instructions multiply a 32-bit and a 16-bit value
(both signed) and return the top 32 bits of the 48-bit result. This
preserves the 16 bits of overflow, whereas the patterns they currently
match truncate the result to 16 bits then sign extend.

To select these instructions, we would need to match an ISD::SMUL_LOHI,
a sign extend, two shifts and an or. There is no way to match SMUL_LOHI
in an instruction pattern as it defines multiple values, so this would
have to be done in C++. I have raised
http://llvm.org/bugs/show_bug.cgi?id=21297 to cover allowing correct
selection of these instructions.

This fixes http://llvm.org/bugs/show_bug.cgi?id=19396

llvm-svn: 220196
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/lib/Target/ARM/ARMInstrThumb2.td
llvm/test/CodeGen/ARM/smulw.ll [new file with mode: 0644]