Skip to content

Commit a2c934a

Browse files
[SystemZ] Allow MAY(R)? to accept the high components of register pairs
The HFP instructions MAY and MAYR, unlike any other floating point instructions, allow the specification of a 128bit register pair by either the lower-numbered or the higher-numbered component register. In order to support this, but change as little about codegen as possible, the existing MAY(R) definition is made `CodeGenOnly`, while a copy is provided for the assembler and disassembler, which simply accepts a 64bit floating point register in place of the 128bit one. This copy is stripped of its pattern to prevent codegen from using it. The corresponding assembly tests that checked the register specification rule that this commit removes from MAY(R)? have also been removed.
1 parent 5ed5d72 commit a2c934a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

llvm/lib/Target/SystemZ/SystemZInstrHFP.td

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,26 @@ def MYH : BinaryRXF<"myh", 0xED3D, null_frag, FP64, FP64, z_load, 8>;
209209
def MYL : BinaryRXF<"myl", 0xED39, null_frag, FP64, FP64, z_load, 8>;
210210

211211
// Fused multiply-add (unnormalized).
212-
def MAYR : TernaryRRD<"mayr", 0xB33A, null_frag, FP128, FP64>;
213212
def MAYHR : TernaryRRD<"mayhr", 0xB33C, null_frag, FP64, FP64>;
214213
def MAYLR : TernaryRRD<"maylr", 0xB338, null_frag, FP64, FP64>;
215-
def MAY : TernaryRXF<"may", 0xED3A, null_frag, FP128, FP64, z_load, 8>;
216214
def MAYH : TernaryRXF<"mayh", 0xED3C, null_frag, FP64, FP64, z_load, 8>;
217215
def MAYL : TernaryRXF<"mayl", 0xED38, null_frag, FP64, FP64, z_load, 8>;
218216

217+
// MAY and MAYR allow the user to specify the floating point register pair making
218+
// up the FP128 register by either the lower-numbered register or the higher-numbered
219+
// register, in contrast to all other floating point instructions. For this
220+
// reason, the codegen and assembly versions of this instruction are kept separate
221+
// in order to allow the assembler and disassembler to accept these registers
222+
// without having to fundamentally change the instruction itself.
223+
let isCodeGenOnly = 1 in {
224+
def MAY : TernaryRXF<"may", 0xED3A, null_frag, FP128, FP64, z_load, 8>;
225+
def MAYR : TernaryRRD<"mayr", 0xB33A, null_frag, FP128, FP64>;
226+
}
227+
let hasNoSchedulingInfo = 1, OpKey = "", OpType = "", Pattern = [] <dag> in {
228+
def MAY_Asm : TernaryRXF<"may", 0xED3A, null_frag, FP64, FP64, z_load, 8>;
229+
def MAYR_Asm : TernaryRRD<"mayr", 0xB33A, null_frag, FP64, FP64>;
230+
}
231+
219232
// Division.
220233
def DER : BinaryRR <"der", 0x3D, null_frag, FP32, FP32>;
221234
def DDR : BinaryRR <"ddr", 0x2D, null_frag, FP64, FP64>;

llvm/test/MC/SystemZ/insn-bad.s

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4176,12 +4176,9 @@
41764176
#CHECK: may %f0, %f0, -1
41774177
#CHECK: error: invalid operand
41784178
#CHECK: may %f0, %f0, 4096
4179-
#CHECK: error: invalid register pair
4180-
#CHECK: may %f2, %f0, 0
41814179

41824180
may %f0, %f0, -1
41834181
may %f0, %f0, 4096
4184-
may %f2, %f0, 0
41854182

41864183
#CHECK: error: invalid operand
41874184
#CHECK: mayh %f0, %f0, -1
@@ -4199,11 +4196,6 @@
41994196
mayl %f0, %f0, -1
42004197
mayl %f0, %f0, 4096
42014198

4202-
#CHECK: error: invalid register pair
4203-
#CHECK: mayr %f2, %f0, %f0
4204-
4205-
mayr %f2, %f0, %f0
4206-
42074199
#CHECK: error: invalid operand
42084200
#CHECK: mc -1, 0
42094201
#CHECK: error: invalid operand

0 commit comments

Comments
 (0)