@@ -291,7 +291,10 @@ typedef enum S390Opcode {
291
291
VRRc_VNO = 0xe76b ,
292
292
VRRc_VO = 0xe76a ,
293
293
VRRc_VOC = 0xe76f ,
294
+ VRRc_VPKS = 0xe797 , /* we leave the m5 cs field 0 */
294
295
VRRc_VS = 0xe7f7 ,
296
+ VRRa_VUPH = 0xe7d7 ,
297
+ VRRa_VUPL = 0xe7d6 ,
295
298
VRRc_VX = 0xe76d ,
296
299
VRRf_VLVGP = 0xe762 ,
297
300
@@ -2800,6 +2803,16 @@ static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc,
2800
2803
}
2801
2804
break ;
2802
2805
2806
+ case INDEX_op_s390_vuph_vec:
2807
+ tcg_out_insn (s, VRRa, VUPH, a0, a1, vece);
2808
+ break ;
2809
+ case INDEX_op_s390_vupl_vec:
2810
+ tcg_out_insn (s, VRRa, VUPL, a0, a1, vece);
2811
+ break ;
2812
+ case INDEX_op_s390_vpks_vec:
2813
+ tcg_out_insn (s, VRRc, VPKS, a0, a1, a2, vece);
2814
+ break ;
2815
+
2803
2816
case INDEX_op_mov_vec: /* Always emitted via tcg_out_mov. */
2804
2817
case INDEX_op_dup_vec: /* Always emitted via tcg_out_dup_vec. */
2805
2818
default :
@@ -2842,6 +2855,9 @@ int tcg_can_emit_vec_op(TCGOpcode opc, TCGType type, unsigned vece)
2842
2855
return -1 ;
2843
2856
case INDEX_op_mul_vec:
2844
2857
return vece < MO_64;
2858
+ case INDEX_op_ssadd_vec:
2859
+ case INDEX_op_sssub_vec:
2860
+ return vece < MO_64 ? -1 : 0 ;
2845
2861
default :
2846
2862
return 0 ;
2847
2863
}
@@ -2897,6 +2913,43 @@ static void expand_vec_cmp(TCGType type, unsigned vece, TCGv_vec v0,
2897
2913
}
2898
2914
}
2899
2915
2916
+ static void expand_vec_sat (TCGType type, unsigned vece, TCGv_vec v0,
2917
+ TCGv_vec v1, TCGv_vec v2, TCGOpcode add_sub_opc)
2918
+ {
2919
+ TCGv_vec h1 = tcg_temp_new_vec (type);
2920
+ TCGv_vec h2 = tcg_temp_new_vec (type);
2921
+ TCGv_vec l1 = tcg_temp_new_vec (type);
2922
+ TCGv_vec l2 = tcg_temp_new_vec (type);
2923
+
2924
+ tcg_debug_assert (vece < MO_64);
2925
+
2926
+ /* Unpack with sign-extension. */
2927
+ vec_gen_2 (INDEX_op_s390_vuph_vec, type, vece,
2928
+ tcgv_vec_arg (h1), tcgv_vec_arg (v1));
2929
+ vec_gen_2 (INDEX_op_s390_vuph_vec, type, vece,
2930
+ tcgv_vec_arg (h2), tcgv_vec_arg (v2));
2931
+
2932
+ vec_gen_2 (INDEX_op_s390_vupl_vec, type, vece,
2933
+ tcgv_vec_arg (l1), tcgv_vec_arg (v1));
2934
+ vec_gen_2 (INDEX_op_s390_vupl_vec, type, vece,
2935
+ tcgv_vec_arg (l2), tcgv_vec_arg (v2));
2936
+
2937
+ /* Arithmetic on a wider element size. */
2938
+ vec_gen_3 (add_sub_opc, type, vece + 1 , tcgv_vec_arg (h1),
2939
+ tcgv_vec_arg (h1), tcgv_vec_arg (h2));
2940
+ vec_gen_3 (add_sub_opc, type, vece + 1 , tcgv_vec_arg (l1),
2941
+ tcgv_vec_arg (l1), tcgv_vec_arg (l2));
2942
+
2943
+ /* Pack with saturation. */
2944
+ vec_gen_3 (INDEX_op_s390_vpks_vec, type, vece + 1 ,
2945
+ tcgv_vec_arg (v0), tcgv_vec_arg (h1), tcgv_vec_arg (l1));
2946
+
2947
+ tcg_temp_free_vec (h1);
2948
+ tcg_temp_free_vec (h2);
2949
+ tcg_temp_free_vec (l1);
2950
+ tcg_temp_free_vec (l2);
2951
+ }
2952
+
2900
2953
void tcg_expand_vec_op (TCGOpcode opc, TCGType type, unsigned vece,
2901
2954
TCGArg a0, ...)
2902
2955
{
@@ -2920,6 +2973,13 @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
2920
2973
tcg_temp_free_vec (t0);
2921
2974
break ;
2922
2975
2976
+ case INDEX_op_ssadd_vec:
2977
+ expand_vec_sat (type, vece, v0, v1, v2, INDEX_op_add_vec);
2978
+ break ;
2979
+ case INDEX_op_sssub_vec:
2980
+ expand_vec_sat (type, vece, v0, v1, v2, INDEX_op_sub_vec);
2981
+ break ;
2982
+
2923
2983
default :
2924
2984
g_assert_not_reached ();
2925
2985
}
@@ -3080,6 +3140,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
3080
3140
case INDEX_op_sari_vec:
3081
3141
case INDEX_op_shli_vec:
3082
3142
case INDEX_op_shri_vec:
3143
+ case INDEX_op_s390_vuph_vec:
3144
+ case INDEX_op_s390_vupl_vec:
3083
3145
return C_O1_I1 (v, v);
3084
3146
case INDEX_op_add_vec:
3085
3147
case INDEX_op_sub_vec:
@@ -3099,6 +3161,7 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
3099
3161
case INDEX_op_smin_vec:
3100
3162
case INDEX_op_umax_vec:
3101
3163
case INDEX_op_umin_vec:
3164
+ case INDEX_op_s390_vpks_vec:
3102
3165
return C_O1_I2 (v, v, v);
3103
3166
case INDEX_op_rotls_vec:
3104
3167
case INDEX_op_shls_vec:
0 commit comments