Patchwork [ARM] Fix vec_pack_trunc pattern for vectorize_with_neon_quad.

mail settings
Submitter Ramana Radhakrishnan
Date Aug. 16, 2011, 2:20 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/110187/
State New
Headers show


Ramana Radhakrishnan - Aug. 16, 2011, 2:20 p.m.

While looking at a failure with regrename and
mvectorize-with-neon-quad I noticed that the early-clobber in this
vec_pack_trunc pattern is superfluous given that we can use
reg_overlap_mentioned_p to decide in which order we want to emit these
2 instructions. While it works around the problem in regrename.c I
still think that the behaviour in regrename is a bit suspicious and
needs some more investigation.

Refer to my post on gcc@ for more on that particular case.

I am currently running tests with Ira's patch of this morning

that turns on mvectorize-with-neon-quad by default to make sure there
are no regressions.

Will commit if no regressions.


2011-08-16  Ramana Radhakrishnan  <>

	* config/arm/ (vec_pack_trunc_<mode> VN): Remove
	early-clobber. Adjust output template for overlap checks.


diff --git a/gcc/config/arm/ b/gcc/config/arm/
index 24dd941..06c699a 100644
--- a/gcc/config/arm/
+++ b/gcc/config/arm/
@@ -5631,14 +5631,19 @@ 
 ; the semantics of the instructions require.
 (define_insn "vec_pack_trunc_<mode>"
- [(set (match_operand:<V_narrow_pack> 0 "register_operand" "=&w")
+ [(set (match_operand:<V_narrow_pack> 0 "register_operand" "=w")
 			(match_operand:VN 1 "register_operand" "w"))
 			(match_operand:VN 2 "register_operand" "w"))))]
- "vmovn.i<V_sz_elem>\t%e0, %q1\;vmovn.i<V_sz_elem>\t%f0, %q2"
+ {
+ if (reg_overlap_mentioned_p (operands[0], operands[1]))
+   return "vmovn.i<V_sz_elem>\t%e0, %q1\;vmovn.i<V_sz_elem>\t%f0, %q2";
+ else
+   return "vmovn.i<V_sz_elem>\t%f0, %q2\;vmovn.i<V_sz_elem>\t%e0, %q1";
+ }
  [(set_attr "neon_type" "neon_shift_1")
   (set_attr "length" "8")]