Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 239627) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -6827,6 +6827,32 @@ rs6000_expand_vector_init (rtx target, r return; } + /* Special case initializing vector short/char that are splats if we are on + 64-bit systems with direct move. */ + if (all_same && TARGET_DIRECT_MOVE_64BIT + && (mode == V16QImode || mode == V8HImode)) + { + rtx op0 = XVECEXP (vals, 0, 0); + rtx di_tmp = gen_reg_rtx (DImode); + + if (!REG_P (op0)) + op0 = force_reg (GET_MODE_INNER (mode), op0); + + if (mode == V16QImode) + { + emit_insn (gen_zero_extendqidi2 (di_tmp, op0)); + emit_insn (gen_vsx_vspltb_di (target, di_tmp)); + return; + } + + if (mode == V8HImode) + { + emit_insn (gen_zero_extendhidi2 (di_tmp, op0)); + emit_insn (gen_vsx_vsplth_di (target, di_tmp)); + return; + } + } + /* Store value to stack temp. Load vector element. Splat. However, splat of 64-bit items is not supported on Altivec. */ if (all_same && GET_MODE_SIZE (inner_mode) <= 4) Index: gcc/config/rs6000/vsx.md =================================================================== --- gcc/config/rs6000/vsx.md (revision 239588) +++ gcc/config/rs6000/vsx.md (working copy) @@ -281,6 +281,16 @@ (define_mode_attr VSX_EX [(V16QI "v") (V8HI "v") (V4SI "wa")]) +;; Iterator for the 2 short vector types to do a splat from an integer +(define_mode_iterator VSX_SPLAT_I [V16QI V8HI]) + +;; Mode attribute to give the count for the splat instruction to splat +;; the value in the 64-bit integer slot +(define_mode_attr VSX_SPLAT_COUNT [(V16QI "7") (V8HI "3")]) + +;; Mode attribute to give the suffix for the splat instruction +(define_mode_attr VSX_SPLAT_SUFFIX [(V16QI "b") (V8HI "h")]) + ;; Constants for creating unspecs (define_c_enum "unspec" [UNSPEC_VSX_CONCAT @@ -2766,6 +2776,16 @@ (define_insn "vsx_xxspltw__direct" "xxspltw %x0,%x1,%2" [(set_attr "type" "vecperm")]) +;; V16QI/V8HI splat support on ISA 2.07 +(define_insn "vsx_vsplt_di" + [(set (match_operand:VSX_SPLAT_I 0 "altivec_register_operand" "=v") + (vec_duplicate:VSX_SPLAT_I + (truncate: + (match_operand:DI 1 "altivec_register_operand" "v"))))] + "VECTOR_MEM_VSX_P (mode) && TARGET_DIRECT_MOVE_64BIT" + "vsplt %0,%1," + [(set_attr "type" "vecperm")]) + ;; V2DF/V2DI splat for use by vec_splat builtin (define_insn "vsx_xxspltd_" [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")