<html><body><p><tt><font size="2">Jonas Paulsson <paulsson@linux.vnet.ibm.com> wrote on 30.11.2017 12:11:56:<br><br>> * This intrinsic only stores and does not load:<br>> <br>>    def int_s390_tbegin : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, <br>> llvm_i32_ty],<br>>                                    [IntrNoDuplicate]>;<br>> <br>>      let mayLoad = 1 in  // WRONG: does not load<br>>        def TBEGINC : SideEffectBinarySIL<"tbeginc", 0xE561,<br>>                                          int_s390_tbeginc, imm32zx16>;<br>> <br>> I tried doing [IntrNoDuplicate, WriteOnly<0>], but found that for some <br>> reason that didn't work as I had hoped for.<br></font></tt><br><tt><font size="2">Hmm.  While there is a comment by Richard further down in the file:</font></tt><br><br><tt><font size="2">                                 // In fact write-only but there's no property</font></tt><br><tt><font size="2">                                 // for that.</font></tt><br><br><tt><font size="2">it seems this may no longer be true.  Looking at Intrinsics.td, I now see:</font></tt><br><br><tt><font size="2">// IntrWriteMem - This intrinsic only writes to memory, but does not read from</font></tt><br><tt><font size="2">// memory, and has no other side effects. This means dead stores before calls</font></tt><br><tt><font size="2">// to this intrinsics may be removed.</font></tt><br><tt><font size="2">def IntrWriteMem : IntrinsicProperty;</font></tt><br><br><tt><font size="2"> <br>> * Similarly,<br>> <br>>    def int_s390_ntstg : Intrinsic<[], [llvm_i64_ty, llvm_ptr64_ty],<br>>                                   [IntrArgMemOnly]>;<br>> <br>> does not load, but the using instruction must have the mayLoad flag set. <br>> Again, WriteOnly<1> does not work.<br>> <br>> * This intrinsic:<br>> <br>>    def int_s390_tabort : Intrinsic<[], [llvm_i64_ty],<br>>                                    [IntrNoReturn, Throws]>;<br>> <br>> should have just the hasSideEffects=1 on the instruction, but per the <br>> above intrinsic definition, both mayLoad and mayStore flags are required <br>> on the MI.<br></font></tt><br><tt><font size="2">What about using IntrNoMem plus IntrHasSideEffects ?</font></tt><br><br><tt><font size="2"> <br>> * These two set/read the FP control register, and both have <br>> reg-reg/mem-reg variants. So EFPC and SFPC actually do not touch memory <br>> at all:<br>> <br>>    def int_s390_sfpc : GCCBuiltin<"__builtin_s390_sfpc">,<br>>                        Intrinsic<[], [llvm_i32_ty], []>;<br>>    def int_s390_efpc : GCCBuiltin<"__builtin_s390_efpc">,<br>>                        Intrinsic<[llvm_i32_ty], [], []>;<br>> <br>>    let mayLoad = 1, mayStore = 1 in {<br>>      def EFPC  : InherentRRE<"efpc", 0xB38C, GR32, <br>> int_s390_efpc>;           // no-mem<br>>      def STFPC : StoreInherentS<"stfpc", 0xB29C, storei<int_s390_efpc>, <br>> 4>;  // stores<br>> <br>>     def SFPC : SideEffectUnaryRRE<"sfpc", 0xB384, GR32, <br>> int_s390_sfpc>;      // no-mem<br>>     def LFPC : SideEffectUnaryS<"lfpc", 0xB29D, loadu<int_s390_sfpc>, <br>> 4>;>;  // loads<br>> }<br>> <br>> Is the proper solution in this case to make a duplicate version for each <br>> intrinsic that does not touch memory?<br></font></tt><br><tt><font size="2">I'd just use IntrNoMem here.  The variants that match the mem-reg cases</font></tt><br><tt><font size="2">will have both the intrinsic and a load/store node in the DAG, and will</font></tt><br><tt><font size="2">inherit the mayLoad / mayStore property from the latter node.</font></tt><br><br><tt><font size="2">Bye,</font></tt><br><tt><font size="2">Ulrich</font></tt><br><BR>
</body></html>