From 299fdd814f4c2850d44387d24c440980c5377d3e Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 10 Sep 2013 10:20:32 +0000 Subject: [SystemZ] Add TM and TMY The main complication here is that TM and TMY (the memory forms) set CC differently from the register forms. When the tested bits contain some 0s and some 1s, the register forms set CC to 1 or 2 based on the value the uppermost bit. The memory forms instead set CC to 1 regardless of the uppermost bit. Until now, I've tried to make it so that a branch never tests for an impossible CC value. E.g. NR only sets CC to 0 or 1, so branches on the result will only test for 0 or 1. Originally I'd tried to do the same thing for TM and TMY by using custom matching code in ISelDAGToDAG. That ended up being very ugly though, and would have meant duplicating some of the chain checks that the common isel code does. I've therefore gone for the simpler alternative of adding an extra operand to the TM DAG opcode to say whether a memory form would be OK. This means that the inverse of a "TM;JE" is "TM;JNE" rather than the more precise "TM;JNLE", just like the inverse of "TMLL;JE" is "TMLL;JNE". I suppose that's arguably less confusing though... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190400 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/MC/SystemZ/insn-bad.s | 34 ++++++++++++++++++++++++++++++++++ test/MC/SystemZ/insn-good.s | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) (limited to 'test/MC/SystemZ') diff --git a/test/MC/SystemZ/insn-bad.s b/test/MC/SystemZ/insn-bad.s index a7affaef2f..923c6ac99a 100644 --- a/test/MC/SystemZ/insn-bad.s +++ b/test/MC/SystemZ/insn-bad.s @@ -2951,6 +2951,23 @@ sy %r0, -524289 sy %r0, 524288 +#CHECK: error: invalid operand +#CHECK: tm -1, 0 +#CHECK: error: invalid operand +#CHECK: tm 4096, 0 +#CHECK: error: invalid use of indexed addressing +#CHECK: tm 0(%r1,%r2), 0 +#CHECK: error: invalid operand +#CHECK: tm 0, -1 +#CHECK: error: invalid operand +#CHECK: tm 0, 256 + + tm -1, 0 + tm 4096, 0 + tm 0(%r1,%r2), 0 + tm 0, -1 + tm 0, 256 + #CHECK: error: invalid operand #CHECK: tmhh %r0, -1 #CHECK: error: invalid operand @@ -2983,6 +3000,23 @@ tmll %r0, -1 tmll %r0, 0x10000 +#CHECK: error: invalid operand +#CHECK: tmy -524289, 0 +#CHECK: error: invalid operand +#CHECK: tmy 524288, 0 +#CHECK: error: invalid use of indexed addressing +#CHECK: tmy 0(%r1,%r2), 0 +#CHECK: error: invalid operand +#CHECK: tmy 0, -1 +#CHECK: error: invalid operand +#CHECK: tmy 0, 256 + + tmy -524289, 0 + tmy 524288, 0 + tmy 0(%r1,%r2), 0 + tmy 0, -1 + tmy 0, 256 + #CHECK: error: invalid operand #CHECK: x %r0, -1 #CHECK: error: invalid operand diff --git a/test/MC/SystemZ/insn-good.s b/test/MC/SystemZ/insn-good.s index 0cbccc4a29..52f23eb3fd 100644 --- a/test/MC/SystemZ/insn-good.s +++ b/test/MC/SystemZ/insn-good.s @@ -7336,6 +7336,22 @@ sy %r0, 524287(%r15,%r1) sy %r15, 0 +#CHECK: tm 0, 0 # encoding: [0x91,0x00,0x00,0x00] +#CHECK: tm 4095, 0 # encoding: [0x91,0x00,0x0f,0xff] +#CHECK: tm 0, 255 # encoding: [0x91,0xff,0x00,0x00] +#CHECK: tm 0(%r1), 42 # encoding: [0x91,0x2a,0x10,0x00] +#CHECK: tm 0(%r15), 42 # encoding: [0x91,0x2a,0xf0,0x00] +#CHECK: tm 4095(%r1), 42 # encoding: [0x91,0x2a,0x1f,0xff] +#CHECK: tm 4095(%r15), 42 # encoding: [0x91,0x2a,0xff,0xff] + + tm 0, 0 + tm 4095, 0 + tm 0, 255 + tm 0(%r1), 42 + tm 0(%r15), 42 + tm 4095(%r1), 42 + tm 4095(%r15), 42 + #CHECK: tmhh %r0, 0 # encoding: [0xa7,0x02,0x00,0x00] #CHECK: tmhh %r0, 32768 # encoding: [0xa7,0x02,0x80,0x00] #CHECK: tmhh %r0, 65535 # encoding: [0xa7,0x02,0xff,0xff] @@ -7376,6 +7392,28 @@ tmll %r0, 0xffff tmll %r15, 0 +#CHECK: tmy -524288, 0 # encoding: [0xeb,0x00,0x00,0x00,0x80,0x51] +#CHECK: tmy -1, 0 # encoding: [0xeb,0x00,0x0f,0xff,0xff,0x51] +#CHECK: tmy 0, 0 # encoding: [0xeb,0x00,0x00,0x00,0x00,0x51] +#CHECK: tmy 1, 0 # encoding: [0xeb,0x00,0x00,0x01,0x00,0x51] +#CHECK: tmy 524287, 0 # encoding: [0xeb,0x00,0x0f,0xff,0x7f,0x51] +#CHECK: tmy 0, 255 # encoding: [0xeb,0xff,0x00,0x00,0x00,0x51] +#CHECK: tmy 0(%r1), 42 # encoding: [0xeb,0x2a,0x10,0x00,0x00,0x51] +#CHECK: tmy 0(%r15), 42 # encoding: [0xeb,0x2a,0xf0,0x00,0x00,0x51] +#CHECK: tmy 524287(%r1), 42 # encoding: [0xeb,0x2a,0x1f,0xff,0x7f,0x51] +#CHECK: tmy 524287(%r15), 42 # encoding: [0xeb,0x2a,0xff,0xff,0x7f,0x51] + + tmy -524288, 0 + tmy -1, 0 + tmy 0, 0 + tmy 1, 0 + tmy 524287, 0 + tmy 0, 255 + tmy 0(%r1), 42 + tmy 0(%r15), 42 + tmy 524287(%r1), 42 + tmy 524287(%r15), 42 + #CHECK: x %r0, 0 # encoding: [0x57,0x00,0x00,0x00] #CHECK: x %r0, 4095 # encoding: [0x57,0x00,0x0f,0xff] #CHECK: x %r0, 0(%r1) # encoding: [0x57,0x00,0x10,0x00] -- cgit v1.2.3