<div dir="ltr">Please ignore my previous email. I find the error is due to a typo in my code. In ADDFLOAT should use 'fadd' instead of 'add' for pattern matching.</div><div class="gmail_extra"><br><div class="gmail_quote">2015-10-14 0:06 GMT-04:00 Xiangyang Guo <span dir="ltr"><<a href="mailto:eceguo@gmail.com" target="_blank">eceguo@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I want to define a register with multiple types for a particular backend. I checked the RegisterInfo.td for ARM backend, which covers this case. I tried to do the similar thing but I got errors when I build the backend.</div><div><br></div><div>I did this as following:</div><div><br></div><div>In the RegisterInfo.td, I define the register class like this:</div><div><br></div><div><div><i>def GRRegs : RegisterClass<"FOO", [i32, f32], 32, (add R0, R1, R2, R3)>;</i></div></div><div><br></div><div>In the InstrInfo.td, I define the instruction like this:</div><div><br></div><div><div><i>def ADDINT: InstFOO<(outs GRRegs:$dst),</i></div><div><i>                   (ins GRRegs:$src1, GRRegs:$src2),</i></div><div><i>                   "add-int $dst, $src1, $src2",</i></div><div><i>                   [(set i32:$dst, (add i32:$src1, i32:$src2))]>;</i></div></div><div><br></div><div><div><i>def ADDFLOAT: InstFOO<(outs GRRegs:$dst),</i></div><div><i>                   (ins GRRegs:$src1, GRRegs:$src2),</i></div><div><i>                   "add-float $dst, $src1, $src2",</i></div><div><i>                   [(set f32:$dst, (add f32:$src1, f32:$src2))]>;</i></div></div><div><i><br></i></div><div>Then when I build the backend, it gives me this error:</div><div><i>error: In ADDFLOAT: Type inference contradiction found, merging 'i32' into 'f32'</i><br></div><div><i><br></i></div><div>I appreciate if if anyone can point out my errors or give me any suggestions to make a register with multiple types works? </div><div><br></div><div>Regards,</div><div><br></div><div>Xiangyang</div></div>
</blockquote></div><br></div>