Bug 89765 - [9/10 Regression] Multiple problems with vec-insert implementation on PowerPC
Summary: [9/10 Regression] Multiple problems with vec-insert implementation on PowerPC
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 9.0
: P2 normal
Target Milestone: 9.2
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2019-03-18 19:12 UTC by kelvin
Modified: 2019-05-20 21:32 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc*-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-04-25 00:00:00


Attachments
Reproducer source file (1.86 KB, text/plain)
2019-03-18 19:12 UTC, kelvin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kelvin 2019-03-18 19:12:22 UTC
Created attachment 45993 [details]
Reproducer source file

The attached test program demonstrates multiple shortcomings with the implementation of vec-insert.

If this test program is compiled with

#define SEPARATE_PROBLEM

an internal compiler error results:

$GCC_BUILD/gcc/xgcc -B$GCC_BUILD/gcc/ -g -fno-use-linker-plugin -maltivec -mvsx -O1 -o vec-insert.exe vec-insert.c
vec-insert.c: In function ‘set_auto_n_uint128’:
vec-insert.c:81:1: error: conversion of an SSA_NAME on the left hand side
   81 | set_auto_n_uint128 (vector unsigned __int128 a, int n, unsigned __int128 e)
      | ^~~~~~~~~~~~~~~~~~
VIEW_CONVERT_EXPR<__int128 unsigned>(_1);

VIEW_CONVERT_EXPR<__int128 unsigned>(_1) = e;
vec-insert.c:81:1: internal compiler error: verify_gimple failed
0x10b21feb verify_gimple_in_seq(gimple*)
	/home/kelvin/gcc-root/gcc-trunk/gcc/tree-cfg.c:5046
0x1069c747 gimplify_body(tree_node*, bool)
	/home/kelvin/gcc-root/gcc-trunk/gcc/gimplify.c:13712
0x1069cb13 gimplify_function_tree(tree_node*)
	/home/kelvin/gcc-root/gcc-trunk/gcc/gimplify.c:13802
0x103e94d7 cgraph_node::analyze()
	/home/kelvin/gcc-root/gcc-trunk/gcc/cgraphunit.c:667
0x103edb37 analyze_functions
	/home/kelvin/gcc-root/gcc-trunk/gcc/cgraphunit.c:1126
0x103eeebb symbol_table::finalize_compilation_unit()
	/home/kelvin/gcc-root/gcc-trunk/gcc/cgraphunit.c:2837
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Makefile:26: recipe for target 'vec-insert.exe' failed
make: *** [vec-insert.exe] Error 1

When compiled without defining SEPARATE_PROBLEM, the resulting executable fails, apparently because the translations of the vec_insert built-in  fail to use modulo arithmetic to compute the index of the selector expression.

(A recent patch corrected similar problems in the implementation of vec-extract and this test program is derived from one of the regression tests that was submitted with that patch.)
Comment 1 Richard Biener 2019-04-25 13:21:00 UTC
Seems to work with a cross (but host headers).
Comment 2 Jakub Jelinek 2019-04-25 14:17:38 UTC
The ICE started with r262946.  Short testcase reproduceable with a cross to powerpc64le-linux with -maltivec -mvsx -O1:
typedef unsigned __int128 V __attribute__((vector_size (sizeof (__int128))));

V
foo (unsigned __int128 x, V y, int z)
{
  return __builtin_vec_insert (x, y, z);
}

During gimplification, gimplify_expr does:
12577		    *expr_p = fold_indirect_ref_loc (input_location, *expr_p);
12578		    if (*expr_p != save_expr)
12579		      {
12580			ret = GS_OK;
12581			break;
12582		      }
12583	
12584		    ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
12585					 is_gimple_reg, fb_rvalue);
12586		    if (ret == GS_ERROR)
12587		      break;
on *expr_p:
 <indirect_ref 0x7fffea99d260
    type <integer_type 0x7fffea7f7bd0 __int128 unsigned public unsigned TI
        size <integer_cst 0x7fffea805018 constant 128>
        unit-size <integer_cst 0x7fffea805030 constant 16>
        align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea7f7bd0 precision:128 min <integer_cst 0x7fffea805300 0> max <integer_cst 0x7fffea806028 0xffffffffffffffffffffffffffffffff>
        pointer_to_this <pointer_type 0x7fffea983f18>>
    side-effects
    arg:0 <nop_expr 0x7fffea99d200
        type <pointer_type 0x7fffea983f18 type <integer_type 0x7fffea7f7bd0 __int128 unsigned>
            unsigned DI
            size <integer_cst 0x7fffea7f4fc0 constant 64>
            unit-size <integer_cst 0x7fffea7f4fd8 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffea983f18>
        side-effects
        arg:0 <addr_expr 0x7fffea99d1e0 type <pointer_type 0x7fffea983c78>
            side-effects
            arg:0 <compound_literal_expr 0x7fffea99d1c0 type <vector_type 0x7fffea983d20 V>
                side-effects addressable
                arg:0 <decl_expr 0x7fffea99d1a0 type <vector_type 0x7fffea983d20 V>
                    side-effects arg:0 <var_decl 0x7ffff7ffb3f0 D.2833>
                    pr89765.i:6:10 start: pr89765.i:6:10 finish: pr89765.i:6:29>>
            pr89765.i:6:10 start: pr89765.i:6:10 finish: pr89765.i:6:29>
        pr89765.i:6:10 start: pr89765.i:6:10 finish: pr89765.i:6:29>
    pr89765.i:6:10 start: pr89765.i:6:10 finish: pr89765.i:6:29>
fold_indirect_ref_1 has for this:
14205	      else if (VECTOR_TYPE_P (optype)
14206		       && type == TREE_TYPE (optype))
14207		{
14208		  tree part_width = TYPE_SIZE (type);
14209		  tree index = bitsize_int (0);
14210		  return fold_build3_loc (loc, BIT_FIELD_REF, type, op, part_width,
14211					  index);
14212		}
but match.pd actually folds that into a VIEW_CONVERT_EXPR and we keep it at the lhs and ICE during checking.
Without the match.pd change, we used to have:
  D.2803 = y_2(D);
  BIT_FIELD_REF <D.2803, 128, 0> = x_4(D);
  _6 = D.2803;
even in ssa pass and only ccp1 changed that into:
  _7 = y_2(D);
  _8 = BIT_INSERT_EXPR <_7, x_4(D), 0 (128 bits)>;
  _6 = _8;
Now we ICE already during gimple pass verification.

Shall we special case VIEW_CONVERT_EXPR on lhs of assignment by moving the VCE to the rhs instead?  Something different?
Comment 3 kelvin 2019-04-25 14:22:21 UTC
I have found that removing the pattern in match.pd resolves this issue with no regressions on various powerpc targets.  I have not tested on other platforms.



Index: gcc/match.pd
===================================================================
--- gcc/match.pd        (revision 270020)
+++ gcc/match.pd        (working copy)
@@ -4963,11 +4963,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
  (BIT_FIELD_REF @0 @1 @2))
 
 (simplify
- (BIT_FIELD_REF @0 @1 integer_zerop)
- (if (tree_int_cst_equal (@1, TYPE_SIZE (TREE_TYPE (@0))))
-  (view_convert @0)))
-
-(simplify
  (BIT_FIELD_REF @0 @1 @2)
  (switch
   (if (TREE_CODE (TREE_TYPE (@0)) == COMPLEX_TYPE
Comment 4 Jakub Jelinek 2019-04-25 14:24:45 UTC
That is not the right thing to do.
Anyway, as for the wrong-code, do you see any gcc version where it actually passes?  Tried various versions, e.g. r205000, r235000, r250907 and r268427 and all of them abort, older versions print more messages than newer ones.
Comment 5 Richard Biener 2019-04-25 14:32:19 UTC
I think the issue is that we gimplify

VIEW_CONVERT_EXPR<__int128 unsigned>(<<< Unknown tree: compound_literal_expr
    V D.2833 = y; >>>)

via

12399           case VIEW_CONVERT_EXPR:
12400             if (is_gimple_reg_type (TREE_TYPE (*expr_p))
12401                 && is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
12402               {
12403                 ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
12404                                      post_p, is_gimple_val, fb_rvalue);
(gdb) l
12405                 recalculate_side_effects (*expr_p);
12406                 break;

when in gimplify_expr with fallback == fb_lvalue and gimple_test_f == is_gimple_lvalue.  If we fix that with

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c      (revision 270437)
+++ gcc/gimplify.c      (working copy)
@@ -12397,7 +12397,8 @@ gimplify_expr (tree *expr_p, gimple_seq
          break;
 
        case VIEW_CONVERT_EXPR:
-         if (is_gimple_reg_type (TREE_TYPE (*expr_p))
+         if ((fallback & fb_rvalue)
+             && is_gimple_reg_type (TREE_TYPE (*expr_p))
              && is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
            {
              ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,

then we gimplify to the correct

  VIEW_CONVERT_EXPR<__int128 unsigned>(D.2833) = x;

and yes, we could move the VIEW_CONVERT_EXPR to the RHS as a trick to make
D.2833 SSA rewritable in update-address-taken.

Have to think whether requiring fallback & fb_rvalue is to be used or
if fallback != fb_lvalue is better.  I guess the latter.
Comment 6 Richard Biener 2019-04-25 14:35:52 UTC
Actually we use is_gimple_val so testing fallback & fb_rvalue.
Comment 7 Jakub Jelinek 2019-04-25 14:40:10 UTC
Making this a regression for the ICE, for the wrong-code we don't have a proof of it being a regression.
Comment 8 Richard Biener 2019-04-25 14:54:39 UTC
Btw, the C notation

typedef unsigned __int128 V __attribute__((vector_size (sizeof (__int128))));

V
foo (unsigned __int128 x, V y, int z)
{
  y[0] = x;
}

on x86_64 prouces

{
  VIEW_CONVERT_EXPR<__int128 unsigned[1]>(y)[0] = x;
}

the array-ref prevents the gimplification into SSA.  That also works
for variable indices btw.  It is eventually turns into

  BIT_FIELD_REF <y, 128, 0> = x_2(D);

by gimplification first and then

  y_5 = BIT_INSERT_EXPR <y_4(D), x_2(D), 0 (128 bits)>;

by update-address-taken.  Not sure why the folding doesn't trigger here
but does for ppc64.  The BIT_FIELD_REF is produced by maybe_canonicalize_mem_ref_addr which uses build3 instead of fold_build3
to build the BIT_FIELD_REF (probably not expecting simplification or
avoding constant folding on the LHS).  Indeed using fold_build3 there
gets us

  VIEW_CONVERT_EXPR<__int128 unsigned>(y) = x;
Comment 9 Jakub Jelinek 2019-04-25 17:59:27 UTC
Author: jakub
Date: Thu Apr 25 17:58:56 2019
New Revision: 270579

URL: https://gcc.gnu.org/viewcvs?rev=270579&root=gcc&view=rev
Log:
	PR middle-end/89765
	* gimplify.c (gimplify_expr): Avoid turning a lvalue
	VIEW_CONVERT_EXPR into one operating on an rvalue.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
Comment 10 Richard Biener 2019-04-26 07:07:52 UTC
Not mine for the rest.
Comment 11 Jakub Jelinek 2019-05-03 09:15:27 UTC
GCC 9.1 has been released.
Comment 12 kelvin 2019-05-07 21:41:18 UTC
Author: kelvin
Date: Tue May  7 21:40:46 2019
New Revision: 270982

URL: https://gcc.gnu.org/viewcvs?rev=270982&root=gcc&view=rev
Log:
gcc/ChangeLog:

2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic
	to compute vector element selector for both constant and variable
	operands.

gcc/testsuite/ChangeLog:

2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* gcc.target/powerpc/pr89765-mc.c: New test.
	* gcc.target/powerpc/vsx-builtin-10c.c: New test.
	* gcc.target/powerpc/vsx-builtin-10d.c: New test.
	* gcc.target/powerpc/vsx-builtin-11c.c: New test.
	* gcc.target/powerpc/vsx-builtin-11d.c: New test.
	* gcc.target/powerpc/vsx-builtin-12c.c: New test.
	* gcc.target/powerpc/vsx-builtin-12d.c: New test.
	* gcc.target/powerpc/vsx-builtin-13c.c: New test.
	* gcc.target/powerpc/vsx-builtin-13d.c: New test.
	* gcc.target/powerpc/vsx-builtin-14c.c: New test.
	* gcc.target/powerpc/vsx-builtin-14d.c: New test.
	* gcc.target/powerpc/vsx-builtin-15c.c: New test.
	* gcc.target/powerpc/vsx-builtin-15d.c: New test.
	* gcc.target/powerpc/vsx-builtin-16c.c: New test.
	* gcc.target/powerpc/vsx-builtin-16d.c: New test.
	* gcc.target/powerpc/vsx-builtin-17c.c: New test.
	* gcc.target/powerpc/vsx-builtin-17d.c: New test.
	* gcc.target/powerpc/vsx-builtin-18c.c: New test.
	* gcc.target/powerpc/vsx-builtin-18d.c: New test.
	* gcc.target/powerpc/vsx-builtin-19c.c: New test.
	* gcc.target/powerpc/vsx-builtin-19d.c: New test.
	* gcc.target/powerpc/vsx-builtin-20c.c: New test.
	* gcc.target/powerpc/vsx-builtin-20d.c: New test.
	* gcc.target/powerpc/vsx-builtin-9c.c: New test.
	* gcc.target/powerpc/vsx-builtin-9d.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c
    trunk/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000-c.c
    trunk/gcc/testsuite/ChangeLog
Comment 13 kelvin 2019-05-10 14:00:57 UTC
Author: kelvin
Date: Fri May 10 14:00:17 2019
New Revision: 271064

URL: https://gcc.gnu.org/viewcvs?rev=271064&root=gcc&view=rev
Log:
gcc/ChangeLog:

2019-05-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic
	to compute vector element selector for both constant and variable
	operands.

gcc/testsuite/ChangeLog:

2019-05-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* gcc.target/powerpc/pr89765-mc.c: New test.
	* gcc.target/powerpc/vsx-builtin-10c.c: New test.
	* gcc.target/powerpc/vsx-builtin-10d.c: New test.
	* gcc.target/powerpc/vsx-builtin-11c.c: New test.
	* gcc.target/powerpc/vsx-builtin-11d.c: New test.
	* gcc.target/powerpc/vsx-builtin-12c.c: New test.
	* gcc.target/powerpc/vsx-builtin-12d.c: New test.
	* gcc.target/powerpc/vsx-builtin-13c.c: New test.
	* gcc.target/powerpc/vsx-builtin-13d.c: New test.
	* gcc.target/powerpc/vsx-builtin-14c.c: New test.
	* gcc.target/powerpc/vsx-builtin-14d.c: New test.
	* gcc.target/powerpc/vsx-builtin-15c.c: New test.
	* gcc.target/powerpc/vsx-builtin-15d.c: New test.
	* gcc.target/powerpc/vsx-builtin-16c.c: New test.
	* gcc.target/powerpc/vsx-builtin-16d.c: New test.
	* gcc.target/powerpc/vsx-builtin-17c.c: New test.
	* gcc.target/powerpc/vsx-builtin-17d.c: New test.
	* gcc.target/powerpc/vsx-builtin-18c.c: New test.
	* gcc.target/powerpc/vsx-builtin-18d.c: New test.
	* gcc.target/powerpc/vsx-builtin-19c.c: New test.
	* gcc.target/powerpc/vsx-builtin-19d.c: New test.
	* gcc.target/powerpc/vsx-builtin-20c.c: New test.
	* gcc.target/powerpc/vsx-builtin-20d.c: New test.
	* gcc.target/powerpc/vsx-builtin-9c.c: New test.
	* gcc.target/powerpc/vsx-builtin-9d.c: New test.


Added:
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c
    branches/gcc-9-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c
Modified:
    branches/gcc-9-branch/gcc/ChangeLog
    branches/gcc-9-branch/gcc/config/rs6000/rs6000-c.c
    branches/gcc-9-branch/gcc/testsuite/ChangeLog
Comment 14 kelvin 2019-05-16 21:11:04 UTC
Author: kelvin
Date: Thu May 16 21:10:32 2019
New Revision: 271297

URL: https://gcc.gnu.org/viewcvs?rev=271297&root=gcc&view=rev
Log:
gcc/ChangeLog:

2019-05-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic
	to compute vector element selector for both constant and variable
	operands.

gcc/testsuite/ChangeLog:

2019-05-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* gcc.target/powerpc/pr89765-mc.c: New test.
	* gcc.target/powerpc/vsx-builtin-10c.c: New test.
	* gcc.target/powerpc/vsx-builtin-10d.c: New test.
	* gcc.target/powerpc/vsx-builtin-11c.c: New test.
	* gcc.target/powerpc/vsx-builtin-11d.c: New test.
	* gcc.target/powerpc/vsx-builtin-12c.c: New test.
	* gcc.target/powerpc/vsx-builtin-12d.c: New test.
	* gcc.target/powerpc/vsx-builtin-13c.c: New test.
	* gcc.target/powerpc/vsx-builtin-13d.c: New test.
	* gcc.target/powerpc/vsx-builtin-14c.c: New test.
	* gcc.target/powerpc/vsx-builtin-14d.c: New test.
	* gcc.target/powerpc/vsx-builtin-15c.c: New test.
	* gcc.target/powerpc/vsx-builtin-15d.c: New test.
	* gcc.target/powerpc/vsx-builtin-16c.c: New test.
	* gcc.target/powerpc/vsx-builtin-16d.c: New test.
	* gcc.target/powerpc/vsx-builtin-17c.c: New test.
	* gcc.target/powerpc/vsx-builtin-17d.c: New test.
	* gcc.target/powerpc/vsx-builtin-18c.c: New test.
	* gcc.target/powerpc/vsx-builtin-18d.c: New test.
	* gcc.target/powerpc/vsx-builtin-19c.c: New test.
	* gcc.target/powerpc/vsx-builtin-19d.c: New test.
	* gcc.target/powerpc/vsx-builtin-20c.c: New test.
	* gcc.target/powerpc/vsx-builtin-20d.c: New test.
	* gcc.target/powerpc/vsx-builtin-9c.c: New test.
	* gcc.target/powerpc/vsx-builtin-9d.c: New test.


Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c
    branches/gcc-8-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/config/rs6000/rs6000-c.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 15 kelvin 2019-05-20 20:07:44 UTC
Author: kelvin
Date: Mon May 20 20:07:12 2019
New Revision: 271436

URL: https://gcc.gnu.org/viewcvs?rev=271436&root=gcc&view=rev
Log:
gcc/ChangeLog:

2019-05-20  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
	In handling of ALTIVEC_BUILTIN_VEC_INSERT, use modular arithmetic
	to compute vector element selector for both constant and variable
	operands.

gcc/testsuite/ChangeLog:

2019-05-20  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	Backport from mainline.
	2019-05-07  Kelvin Nilsen  <kelvin@gcc.gnu.org>

	PR target/89765
	* gcc.target/powerpc/pr89765-mc.c: New test.
	* gcc.target/powerpc/vsx-builtin-10c.c: New test.
	* gcc.target/powerpc/vsx-builtin-10d.c: New test.
	* gcc.target/powerpc/vsx-builtin-11c.c: New test.
	* gcc.target/powerpc/vsx-builtin-11d.c: New test.
	* gcc.target/powerpc/vsx-builtin-12c.c: New test.
	* gcc.target/powerpc/vsx-builtin-12d.c: New test.
	* gcc.target/powerpc/vsx-builtin-13c.c: New test.
	* gcc.target/powerpc/vsx-builtin-13d.c: New test.
	* gcc.target/powerpc/vsx-builtin-14c.c: New test.
	* gcc.target/powerpc/vsx-builtin-14d.c: New test.
	* gcc.target/powerpc/vsx-builtin-15c.c: New test.
	* gcc.target/powerpc/vsx-builtin-15d.c: New test.
	* gcc.target/powerpc/vsx-builtin-16c.c: New test.
	* gcc.target/powerpc/vsx-builtin-16d.c: New test.
	* gcc.target/powerpc/vsx-builtin-17c.c: New test.
	* gcc.target/powerpc/vsx-builtin-17d.c: New test.
	* gcc.target/powerpc/vsx-builtin-18c.c: New test.
	* gcc.target/powerpc/vsx-builtin-18d.c: New test.
	* gcc.target/powerpc/vsx-builtin-19c.c: New test.
	* gcc.target/powerpc/vsx-builtin-19d.c: New test.
	* gcc.target/powerpc/vsx-builtin-20c.c: New test.
	* gcc.target/powerpc/vsx-builtin-20d.c: New test.
	* gcc.target/powerpc/vsx-builtin-9c.c: New test.
	* gcc.target/powerpc/vsx-builtin-9d.c: New test.


Added:
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/pr89765-mc.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-10d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-11d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-12d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-13d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-14d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-15d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-16d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-17d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-18d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-19d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-20d.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9c.c
    branches/gcc-7-branch/gcc/testsuite/gcc.target/powerpc/vsx-builtin-9d.c
Modified:
    branches/gcc-7-branch/gcc/ChangeLog
    branches/gcc-7-branch/gcc/config/rs6000/rs6000-c.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
Comment 16 kelvin 2019-05-20 21:32:01 UTC
Patches committed to trunk and backported to gcc9, gcc8, and gcc7.