[Bug middle-end/70434] [5/6 Regression] adding an extraneous cast to vector type results in inferior code

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 29 13:30:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70434

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-03-29
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue starts in the FE:

;; Function foo4 (null)
;; enabled by -tree-original


{
  *(int *) &v = *(int *) &v ^ *((int *) &v + 4);
  return *((int *) &TARGET_EXPR <D.2617, SAVE_EXPR <VIEW_CONVERT_EXPR<vector(4)
int>(v)>> + (sizetype) ((long unsigned int) x * 4));
}


;; Function bar4 (null)
;; enabled by -tree-original


{
  *(int *) &v = *(int *) &v ^ *((int *) &v + 4);
  return *((int *) &v + (sizetype) ((long unsigned int) x * 4));
}


notice the extra address-taken temporary D.2617.  We end up with

bar4 (int x, v4si v)
{
  int _2;
  int _3;
  int _4;
  long unsigned int _7;
  long unsigned int _8;
  int * _9;
  int _10;

  <bb 2>:
  _2 = BIT_FIELD_REF <v, 32, 0>;
  _3 = BIT_FIELD_REF <v, 32, 32>;
  _4 = _2 ^ _3;
  BIT_FIELD_REF <v, 32, 0> = _4;
  _7 = (long unsigned int) x_6(D);
  _8 = _7 * 4;
  _9 = &v + _8;
  _10 = *_9;
  return _10;

vs.

foo4 (int x, v4si v)
{
  vector(4) int D.2617;
  int _2;
  int _3;
  int _4;
  vector(4) int v.1_6;
  long unsigned int _9;
  long unsigned int _10;
  int * _11;
  int _12;

  <bb 2>:
  _2 = BIT_FIELD_REF <v, 32, 0>;
  _3 = BIT_FIELD_REF <v, 32, 32>;
  _4 = _2 ^ _3;
  BIT_FIELD_REF <v, 32, 0> = _4;
  v.1_6 = v;
  D.2617 = v.1_6;
  _9 = (long unsigned int) x_8(D);
  _10 = _9 * 4;
  _11 = &D.2617 + _10;
  _12 = *_11;
  return _12;


More information about the Gcc-bugs mailing list