This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Powerpc patch #4, Add power7/vsx support
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 26 Jul 2009 00:55:11 -0400
- Subject: Re: [PATCH] Powerpc patch #4, Add power7/vsx support
+(define_expand "vector_copysign<mode>3"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (if_then_else:VEC_F
+ (ge:VEC_F (match_operand:VEC_F 2 "vfloat_operand" "")
+ (const_int 0))
+ (abs:VEC_F (match_operand:VEC_F 1 "vfloat_operand" ""))
+ (neg:VEC_F (abs:VEC_F (match_dup 1)))))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "
+{
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_copysign_v4sf3 (operands[0], operands[1],
+ operands[2]));
+ DONE;
+ }
+}")
+;; Copy sign
+(define_insn "vsx_copysign<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (if_then_else:VSX_B
+ (ge:VSX_B (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")
+ (const_int 0))
+ (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))
+ (neg:VSX_B (abs:VSX_B (match_dup 1)))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cpsgn<VSs> %x0,%x2,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
The vector floating point operands should not be compared with
(const_int 0), the define_expand should use CONST0_RTX (mode) and the
define_insn probably needs a new, dedicated predicate and constraint
"F".
Also, I noticed that an overlap previously was introduced in UNSPEC
numbers between rs6000.md and altivec.md. Because the previous
altivec.md patch removed 51-62 from altivec.md, I think it would be
best to redefine UNSPEC_VCMPBFP as 64.
Thanks, David