diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-19 12:56:58 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-08-19 12:56:58 +0000 |
commit | 784a58031227a8e125cd55920062ff6e9f3d5200 (patch) | |
tree | e7dd996643c4873a68c8c0a3f885ce1b9d2a2c8f /llvm/lib | |
parent | 4b89705490ae9616b0ef0876595bf61cd3502b1e (diff) | |
download | bcm5719-llvm-784a58031227a8e125cd55920062ff6e9f3d5200.tar.gz bcm5719-llvm-784a58031227a8e125cd55920062ff6e9f3d5200.zip |
[SystemZ] Add negative integer absolute (load negative)
For now this matches the equivalent of (neg (abs ...)), which did hit a few
times in projects/test-suite. We should probably also match cases where
absolute-like selects are used with reversed arguments.
llvm-svn: 188671
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/SystemZ/README.txt | 6 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZInstrInfo.td | 10 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZOperators.td | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Target/SystemZ/README.txt b/llvm/lib/Target/SystemZ/README.txt index 93e29b8a0fa..58e631f88c0 100644 --- a/llvm/lib/Target/SystemZ/README.txt +++ b/llvm/lib/Target/SystemZ/README.txt @@ -104,12 +104,6 @@ such as ICM and STCM. -- -DAGCombiner can detect integer absolute, but there's not yet an associated -ISD opcode. We could add one and implement it using LOAD POSITIVE. -Negated absolutes could use LOAD NEGATIVE. - --- - DAGCombiner doesn't yet fold truncations of extended loads. Functions like: unsigned long f (unsigned long x, unsigned short *y) diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td index dd3a9bca088..d857a572fb9 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td @@ -549,6 +549,16 @@ defm : SXU<z_iabs64, LPGFR>; let Defs = [CC] in { let CCValues = 0xF, CompareZeroCCMask = 0x8 in { + def LNR : UnaryRR <"ln", 0x11, z_inegabs32, GR32, GR32>; + def LNGR : UnaryRRE<"lng", 0xB901, z_inegabs64, GR64, GR64>; + } + let CCValues = 0xE, CompareZeroCCMask = 0xE in + def LNGFR : UnaryRRE<"lngf", 0xB911, null_frag, GR64, GR32>; +} +defm : SXU<z_inegabs64, LNGFR>; + +let Defs = [CC] in { + let CCValues = 0xF, CompareZeroCCMask = 0x8 in { def LCR : UnaryRR <"lc", 0x13, ineg, GR32, GR32>; def LCGR : UnaryRRE<"lcg", 0xB903, ineg, GR64, GR64>; } diff --git a/llvm/lib/Target/SystemZ/SystemZOperators.td b/llvm/lib/Target/SystemZ/SystemZOperators.td index 59e1ffcfcfa..5745e29cd8f 100644 --- a/llvm/lib/Target/SystemZ/SystemZOperators.td +++ b/llvm/lib/Target/SystemZ/SystemZOperators.td @@ -247,6 +247,8 @@ def z_iabs32 : PatFrag<(ops node:$src), def z_iabs64 : PatFrag<(ops node:$src), (xor (add node:$src, (sra node:$src, (i32 63))), (sra node:$src, (i32 63)))>; +def z_inegabs32 : PatFrag<(ops node:$src), (ineg (z_iabs32 node:$src))>; +def z_inegabs64 : PatFrag<(ops node:$src), (ineg (z_iabs64 node:$src))>; // Fused multiply-add and multiply-subtract, but with the order of the // operands matching SystemZ's MA and MS instructions. |