This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [power7-meissner] Add __builtin_bswap{16,64} support to powerpc


Michael Meissner wrote:
+(define_expand "bswaphi2"
+  [(use (match_operand:SI 0 "gpc_reg_operand" ""))
+   (use (match_operand:SI 1 "gpc_reg_operand" ""))]
+  "TARGET_POWERPC"
+  {
+    rtx inp = gen_reg_rtx (HImode);
+    rtx out = gen_reg_rtx (HImode);
+
+    emit_move_insn (inp, simplify_gen_subreg (HImode, operands[1], SImode, 2));
+    emit_insn (gen_bswaphi2_internal (out, inp));
+    emit_insn (gen_zero_extendhisi2 (operands[0], out));
+    DONE;
+  })

Please don't put all this SImode nonsense in a pattern that, by name and middle-end convention, is supposed to operate on HImode values.

As for the non-existance of bswap16 as a generic builtin...
frankly I don't see why we can't add one for the sake of
consistency.


r~



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]