[committed] Unbreak powerpc* bootstrap (PR bootstrap/92433)
diff mbox series

Message ID 20191111200948.GZ4650@tucnak
State New
Headers show
Series
  • [committed] Unbreak powerpc* bootstrap (PR bootstrap/92433)
Related show

Commit Message

Jakub Jelinek Nov. 11, 2019, 8:09 p.m. UTC
Hi!

A recent unroller change results in the arg_types array initializing
loop in altivec_build_resolved_builtin being completely unrolled.
The callers ensure that for ALTIVEC_BUILTIN_VEC_VCMPGE_P all the 3
arguments are provided (i.e. n == 3), but the compiler doesn't know that
and emits -Wmaybe-uninitialized warning.

Fixed thusly, additionally simplified the code/made it more readable
with std::swap.  Bootstrapped/regtested on powerpc64le-linux, preapproved by
Segher on IRC, committed to trunk.

2019-11-11  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/92433
	* config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Guard
	ALTIVEC_BUILTIN_VEC_VCMPGE_P argument swapping with n == 3 check.  Use
	std::swap.


	Jakub

Patch
diff mbox series

--- gcc/config/rs6000/rs6000-c.c.jj	2019-08-27 12:26:30.115019661 +0200
+++ gcc/config/rs6000/rs6000-c.c	2019-11-11 10:12:00.954282097 +0100
@@ -6076,14 +6076,14 @@  altivec_build_resolved_builtin (tree *ar
      condition (LT vs. EQ, which is recognizable by bit 1 of the first
      argument) is reversed.  Patch the arguments here before building
      the resolved CALL_EXPR.  */
-  if (desc->code == ALTIVEC_BUILTIN_VEC_VCMPGE_P
+  if (n == 3
+      && desc->code == ALTIVEC_BUILTIN_VEC_VCMPGE_P
       && desc->overloaded_code != ALTIVEC_BUILTIN_VCMPGEFP_P
       && desc->overloaded_code != VSX_BUILTIN_XVCMPGEDP_P)
     {
-      tree t;
-      t = args[2], args[2] = args[1], args[1] = t;
-      t = arg_type[2], arg_type[2] = arg_type[1], arg_type[1] = t;
-      
+      std::swap (args[1], args[2]);
+      std::swap (arg_type[1], arg_type[2]);
+
       args[0] = fold_build2 (BIT_XOR_EXPR, TREE_TYPE (args[0]), args[0],
 			     build_int_cst (NULL_TREE, 2));
     }