Skip to content

Commit ec893da

Browse files
committed
[GlobalISel] Remove semantic operand of G_IS_FPCLASS
Instruction G_IS_FPCLASS had an operand that represented floating-point semantics of its first operand. It allowed types that have the same length, like `bfloat16` and `half`, to be distinguished. Unfortunately, it is not sufficient, as other operation still cannot distinguish such types. Solution of this problem must be more general, so now this operand is removed. Differential Revision: https://reviews.llvm.org/D138004
1 parent b97911c commit ec893da

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

llvm/docs/GlobalISel/GenericOpcode.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ G_IS_FPCLASS
484484
^^^^^^^^^^^^
485485

486486
Tests if the first operand, which must be floating-point scalar or vector, has
487-
floating-point class specified by the second operand. The third operand
488-
specifies floating-point semantics of the tested value. Returns non-zero (true)
487+
floating-point class specified by the second operand. Returns non-zero (true)
489488
or zero (false). It's target specific whether a true value is 1, ~0U, or some
490489
other non-zero value. If the first operand is a vector, the returned value is a
491490
vector of the same length.

llvm/include/llvm/Target/GenericOpcodes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def G_FCANONICALIZE : GenericInstruction {
748748
// Generic opcode equivalent to the llvm.is_fpclass intrinsic.
749749
def G_IS_FPCLASS: GenericInstruction {
750750
let OutOperandList = (outs type0:$dst);
751-
let InOperandList = (ins type1:$src, unknown:$test, unknown:$fpsem);
751+
let InOperandList = (ins type1:$src, unknown:$test);
752752
let hasSideEffects = false;
753753
}
754754

llvm/lib/CodeGen/MachineVerifier.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,16 +1714,6 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) {
17141714
report("Incorrect floating-point class set (operand 2)", MI);
17151715
break;
17161716
}
1717-
const MachineOperand &SemanticsMO = MI->getOperand(3);
1718-
if (!SemanticsMO.isImm()) {
1719-
report("floating-point semantics (operand 3) must be an immediate", MI);
1720-
break;
1721-
}
1722-
int64_t Semantics = SemanticsMO.getImm();
1723-
if (Semantics < 0 || Semantics > APFloat::S_MaxSemantics) {
1724-
report("Incorrect floating-point semantics (operand 3)", MI);
1725-
break;
1726-
}
17271717
break;
17281718
}
17291719
case TargetOpcode::G_ASSERT_ALIGN: {

llvm/test/MachineVerifier/test_g_is_fpclass.mir

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,23 @@ body: |
1515
%ptr:_(p0) = COPY $x0
1616
%vector:_(<4 x s32>) = COPY $q0
1717
18-
%val1:_(s1) = G_IS_FPCLASS %s32, 1
18+
%val1:_(s1) = G_IS_FPCLASS %s32
1919
; CHECK: *** Bad machine code: Too few operands ***
20-
; CHECK: 4 operands expected, but 3 given.
20+
; CHECK: 3 operands expected, but 2 given.
2121
22-
%val2:_(p0) = G_IS_FPCLASS %s32, 3, 2
22+
%val2:_(p0) = G_IS_FPCLASS %s32, 3
2323
; CHECK: *** Bad machine code: Destination must be a scalar or vector of scalars ***
2424
25-
%val3:_(s1) = G_IS_FPCLASS %s32, 1, 66
26-
; CHECK: *** Bad machine code: Incorrect floating-point semantics (operand 3) ***
27-
28-
%val4:_(s1) = G_IS_FPCLASS %s32, 7777, 2
25+
%val4:_(s1) = G_IS_FPCLASS %s32, 7777
2926
; CHECK: *** Bad machine code: Incorrect floating-point class set (operand 2) ***
3027
31-
%val5:_(s1) = G_IS_FPCLASS %ptr:_(p0), 3, 2
28+
%val5:_(s1) = G_IS_FPCLASS %ptr:_(p0), 3
3229
; CHECK: *** Bad machine code: Source must be a scalar or vector of scalars ***
3330
34-
%var6:_(s1) = G_IS_FPCLASS %vector:_(<4 x s32>), 1, 2
31+
%var6:_(s1) = G_IS_FPCLASS %vector:_(<4 x s32>), 1
3532
; CHECK: *** Bad machine code: operand types must be all-vector or all-scalar ***
3633
37-
%var7:_(<2 x s1>) = G_IS_FPCLASS %vector:_(<4 x s32>), 1, 2
34+
%var7:_(<2 x s1>) = G_IS_FPCLASS %vector:_(<4 x s32>), 1
3835
; CHECK: *** Bad machine code: operand types must preserve number of vector elements ***
3936
4037
...

0 commit comments

Comments
 (0)