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

--- Comment #85 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok, so the options-save.c is really miscompiled. I reduced that down to:

$ cat options-save2.ii
struct cl_optimization {
  /* All have value 0. */
  char x_flag_keep_gc_roots_live;
  char x_flag_lifetime_dse;
  char x_flag_limit_function_alignment;
  char x_flag_live_range_shrinkage;
  char x_flag_loop_interchange;
  char x_flag_loop_nest_optimize;
  char x_flag_loop_parallelize_all;
  char x_flag_unroll_jam;
  char x_flag_lra_remat;
  char x_flag_errno_math;
  char x_flag_modulo_sched;
  char x_flag_modulo_sched_allow_regmoves;
  char x_flag_move_loop_invariants;
  char x_flag_move_loop_stores;
  char x_flag_non_call_exceptions;
  /* Value 1. */
  char x_flag_nothrow_opt;
} cl_optimization_save_ptr;

int val0, val1;

void cl_optimization_save() {
  cl_optimization_save_ptr.x_flag_keep_gc_roots_live = val0;
  cl_optimization_save_ptr.x_flag_lifetime_dse = val0;
  cl_optimization_save_ptr.x_flag_limit_function_alignment = val0;
  cl_optimization_save_ptr.x_flag_live_range_shrinkage = val0;
  cl_optimization_save_ptr.x_flag_loop_interchange = val0;
  cl_optimization_save_ptr.x_flag_loop_nest_optimize = val0;
  cl_optimization_save_ptr.x_flag_loop_parallelize_all = val0;
  cl_optimization_save_ptr.x_flag_unroll_jam = val0;
  cl_optimization_save_ptr.x_flag_lra_remat = val0;
  cl_optimization_save_ptr.x_flag_errno_math = val0;
  cl_optimization_save_ptr.x_flag_modulo_sched = val0;
  cl_optimization_save_ptr.x_flag_modulo_sched_allow_regmoves = val0;
  cl_optimization_save_ptr.x_flag_move_loop_invariants = val0;
  cl_optimization_save_ptr.x_flag_move_loop_stores = val0;
  cl_optimization_save_ptr.x_flag_non_call_exceptions = val0;
  cl_optimization_save_ptr.x_flag_nothrow_opt = val1;
}

$ /tmp/gcc/objdir2/./gcc/xg++ -B/tmp/gcc/objdir2/./gcc/ -O2 options-save2.ii -S
-O3 -march=core2 -o good.s -fno-checking -fdump-rtl-final=good.txt

$ /tmp/gcc/objdir/./prev-gcc/xg++ -B/tmp/gcc/objdir/./prev-gcc/ -O2
options-save2.ii -S -O3 -march=core2 -o good.s -fno-checking
-fdump-rtl-final=bad.txt

diff good.txt bad.txt prints:

 (insn:TI 12 5 39 2 (set (reg:V16QI 23 xmm3 [94])
         (mem/u/c:V16QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0  S16 A128]))
"options-save2.ii":25:54 1652 {movv16qi_internal}
      (expr_list:REG_EQUIV (const_vector:V16QI [
                 (const_int -128 [0xffffffffffffff80]) repeated x8
                 (const_int 0 [0])
                 (const_int 1 [0x1])
                 (const_int 4 [0x4])
                 (const_int 5 [0x5])
-                (const_int 8 [0x8])
-                (const_int 9 [0x9])
-                (const_int 12 [0xc])
-                (const_int 13 [0xd])
+                (const_int -128 [0xffffffffffffff80]) repeated x4
             ])
         (nil)))

So as seen, different vector constants are saved to xmm3.

Reply via email to