I'm trying to write a store pattern that accepts both i32 and f32,
however, when tablegen generates the code, it only generates the code
for i32 only.
def ADDR : ComplexPattern<i32, 2, "SelectADDR", , >;
def MEM : Operand<i32> {
let PrintMethod = "printMemOperand";
let MIOperandInfo = (ops GPR, GPR);
}
def global_st : SDNode<"AMDILISD::GLOBAL_STORE", SDTStore,
[SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
def global_store : PatFrag<(ops node:$val, node:$ptr),
(st node:$val, node:$ptr), [{
return isGlobalStore(dyn_cast<StoreSDNode>(N));
}]>;
def GLOBALSTORE : OneInOneOut<IL_OP_MOV, (outs), (ins GPR:$val,
MEM:$ptr),
"mov g[$ptr], $val",
[(global_store GPR:$val, ADDR:$ptr)]>;
I want this same pattern to be able to accept all the types for val that
GPR is mapped to(i32, i64, f32, f64).
Is there any way I can modify this so that it do what I want?
Here is a snippet of the generated code with the items bolded that I
don't want generated:
if (Predicate_global_store(N.Val)) {
SDValue N1 = N.getOperand(1);
SDValue N2 = N.getOperand(2);
SDValue CPTmp0;
SDValue CPTmp1;
if (SelectADDR(N, N2, CPTmp0, CPTmp1)) {
// Pattern: (st:void GPR:i32:$val,
ADDR:i32:$ptr)<<P:Predicate_global_store>>
// Emits: (GLOBALSTORE_i32:void GPR:i32:$val, ADDR:i32:$ptr)
// Pattern complexity = 13 cost = 1 size = 0
if (N1.Val->getValueType(0) == MVT::i32 &&
N2.Val->getValueType(0) == MVT::i32) {
return Emit_14(N, AMDIL::GLOBALSTORE_i32, CPTmp0, CPTmp1);
}
}
Thanks,
Micah Villmow
Systems Engineer
Advanced Technology & Performance
Advanced Micro Devices Inc.
4555 Great America Pkwy,
Santa Clara, CA. 95054
P: 408-572-6219
F: 408-572-6596