On 12/14/21 7:32 AM, Bill Schmidt wrote: > Hi! > > On 12/13/21 6:22 PM, Segher Boessenkool wrote: >> >> These builtins should just return a "long", just like __builtin_ppc_mftb >> does. All three of them. > Well, that seems wrong for __builtin_darn_32, which maps to an SImode pattern. > > So, I assume what you'd like to see is for the other two built-ins to return > long, and for the "&& TARGET_64BIT" to be removed from the darn_raw and darn > patterns? > For the record, I don't see how this can work. WHen I compile:
#include <altivec.h> long get_raw_random () { return __builtin_darn_raw (); } with these changes, the compiler thinks that __builtin_darn_raw returns a register pair, presumably due to it being a DImode pattern. It then pulls the second register of the pair as the actual result. get_raw_random: .LFB0: darn 10,2 mr 3,11 blr The vregs dump shows: (insn 5 2 6 2 (set (reg:DI 118) (unspec_volatile:DI [ (const_int 0 [0]) ] UNSPECV_DARN_RAW)) "darn-thing.c":11:10 1043 {darn_raw} (nil)) (insn 6 5 10 2 (set (reg:SI 117 [ <retval> ]) (subreg:SI (reg:DI 118) 4)) "darn-thing.c":11:10 543 {*movsi_internal1} (nil)) (insn 10 6 11 2 (set (reg/i:SI 3 3) (reg:SI 117 [ <retval> ])) "darn-thing.c":12:1 543 {*movsi_internal1} (nil)) (insn 11 10 0 2 (use (reg/i:SI 3 3)) "darn-thing.c":12:1 -1 (nil)) So if you want to support these patterns for 32-bit mode, there's more work required. Given this, I'd like to ask you to reconsider the original submitted patch for now. Thanks, Bill