Skip to content

Commit 3d69bbc

Browse files
Allow MAY(R)? to accept the high components of register pairs (#98606)
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 d06b55e commit 3d69bbc

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

llvm/lib/Target/SystemZ/SystemZInstrHFP.td

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,23 @@ 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
218+
// making up the FP128 register by either the lower-numbered register or the
219+
// higher-numbered register, in contrast to all other floating point
220+
// instructions.
221+
// For this reason, the defs below accept `FP64,FP64` instead of `FP128,FP64`.
222+
// This is ok since these instructions are not used in code generation.
223+
// If and when code generation is enabled, the code gen variants should be
224+
// split out from this and use the proper register classes, while these should
225+
// remain for the Assembler and Disassembler to remain compliant with the POP.
226+
def MAY : TernaryRXF<"may", 0xED3A, null_frag, FP64, FP64, z_load, 8>;
227+
def MAYR : TernaryRRD<"mayr", 0xB33A, null_frag, FP64, FP64>;
228+
219229
// Division.
220230
def DER : BinaryRR <"der", 0x3D, null_frag, FP32, FP32>;
221231
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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11526,6 +11526,7 @@
1152611526
#CHECK: may %f0, %f15, 0 # encoding: [0xed,0xf0,0x00,0x00,0x00,0x3a]
1152711527
#CHECK: may %f13, %f0, 0 # encoding: [0xed,0x00,0x00,0x00,0xd0,0x3a]
1152811528
#CHECK: may %f13, %f15, 0 # encoding: [0xed,0xf0,0x00,0x00,0xd0,0x3a]
11529+
#CHECK: may %f2, %f0, 0 # encoding: [0xed,0x00,0x00,0x00,0x20,0x3a]
1152911530

1153011531
may %f0, %f0, 0
1153111532
may %f0, %f0, 4095
@@ -11536,6 +11537,7 @@
1153611537
may %f0, %f15, 0
1153711538
may %f13, %f0, 0
1153811539
may %f13, %f15, 0
11540+
may %f2, %f0, 0
1153911541

1154011542
#CHECK: mayh %f0, %f0, 0 # encoding: [0xed,0x00,0x00,0x00,0x00,0x3c]
1154111543
#CHECK: mayh %f0, %f0, 4095 # encoding: [0xed,0x00,0x0f,0xff,0x00,0x3c]
@@ -11611,13 +11613,15 @@
1161111613
#CHECK: mayr %f13, %f0, %f0 # encoding: [0xb3,0x3a,0xd0,0x00]
1161211614
#CHECK: mayr %f5, %f8, %f9 # encoding: [0xb3,0x3a,0x50,0x89]
1161311615
#CHECK: mayr %f13, %f15, %f15 # encoding: [0xb3,0x3a,0xd0,0xff]
11616+
#CHECK: mayr %f2, %f0, %f0 # encoding: [0xb3,0x3a,0x20,0x00]
1161411617

1161511618
mayr %f0, %f0, %f0
1161611619
mayr %f0, %f0, %f15
1161711620
mayr %f0, %f15, %f0
1161811621
mayr %f13, %f0, %f0
1161911622
mayr %f5, %f8, %f9
1162011623
mayr %f13, %f15, %f15
11624+
mayr %f2, %f0, %f0
1162111625

1162211626
#CHECK: mc 0, 0 # encoding: [0xaf,0x00,0x00,0x00]
1162311627
#CHECK: mc 4095, 0 # encoding: [0xaf,0x00,0x0f,0xff]

0 commit comments

Comments
 (0)