<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello all,<div><br></div><div>Thanks for all the suggestions so far :) They were really helpful!</div><div><br></div><div>Brief background: We are trying to support 64 bit pointers (in address space 1) using custom store/load instructions for an open-source RISCV based GPGPU (<a href="http://bjump.org/manycore/">bjump.org/manycore/</a>). We aim to keep the 64 bit address into two 32 bit register and use our custom store example CUSTOM_STORE rs rd1 rd2 where rd1 and rd2 store 32 bit address parts.</div><div><br></div><div>Legalizer was the main source of pain, so we are breaking the address during legalization and replacing the store node with our custom node during the same phase. </div><div><br></div><div>The DAG after ISel (and probably also after scheduling):</div><div><br></div><div><div>===== Instruction selection ends:</div><div>Selected selection DAG: %bb.0 'main:entry'</div><div>SelectionDAG has 20 nodes:</div><div><div>t0: ch = EntryToken</div><div>t5: i32 = ADDI Register:i32 $x0, TargetConstant:i32<87></div><div>t15: i32 = LUI TargetGlobalAddress:i32<[1 x i32] addrspace(1)* @foo> 0 [TF=2]</div><div>t16: i32 = ADDI t15, TargetGlobalAddress:i32<[1 x i32] addrspace(1)* @foo> 0 [TF=3]</div><div>t19: i32 = LUI TargetGlobalAddress:i32<[1 x i32] addrspace(1)* @foo> 0 [TF=4]</div><div>t20: i32 = ADDI t19, TargetGlobalAddress:i32<[1 x i32] addrspace(1)* @foo> 0 [TF=1]</div><div>t4: ch = SW<Mem:(store 4 into %ir.retval)> t28, TargetFrameIndex:i32<0>, TargetConstant:i32<0>, t0</div><div>t23: ch = CUSTOM_STORE t5, t16, t20, t4</div><div>t11: ch,glue = CopyToReg t23, Register:i32 $x10, t28</div><div>t28: i32,ch = CopyFromReg t0, Register:i32 $x0</div><div>t12: ch = PseudoRET Register:i32 $x10, t11, t11:1</div></div></div><div><br></div><div>But after MachineFunction at end of ISel  Machine code for function main: IsSSA, TracksLiveness we lost the value operand from our custom store.</div><div><br></div><div><div>%0:gpr = COPY $x0</div><div>SW %0:gpr, %stack.0.retval, 0 :: (store 4 into %ir.retval)</div><div>%1:gpr = LUI target-flags(<unknown>) @foo</div><div>%2:gpr = ADDI killed %1:gpr, target-flags(<unknown>) @foo</div><div>%3:gpr = LUI target-flags(<unknown>) @foo</div><div>%4:gpr = ADDI killed %3:gpr, target-flags(<unknown>) @foo</div><div>%5:gpr = ADDI $x0, 87</div><div>CUSTOM_STORE killed %4:gpr, killed %2:gpr</div><div>$x10 = COPY %0:gpr</div><div>PseudoRET implicit $x10</div></div><div><br></div><div>I could not understand why t23: ch = CUSTOM_STORE t5, t16, t20, t4 was converted into CUSTOM_STORE killed %4:gpr, killed %2:gpr. We expect it to be CUSTOM_STORE %5:gpr, killed %4:gpr, killed %2:gpr</div><div><br></div><div>Many thanks,</div><div>Reshabh </div><div><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div>