const vd __builtin_vsx_xvcvspdp (vf);
XVCVSPDP vsx_xvcvspdp {}
- const vsll __builtin_vsx_xvcvspsxds (vf);
- XVCVSPSXDS vsx_xvcvspsxds {}
+ const vsll __builtin_vsignede_v4sf (vf);
+ VEC_VSIGNEDE_V4SF vsignede_v4sf {}
- const vsll __builtin_vsx_xvcvspuxds (vf);
- XVCVSPUXDS vsx_xvcvspuxds {}
+ const vsll __builtin_vsignedo_v4sf (vf);
+ VEC_VSIGNEDO_V4SF vsignedo_v4sf {}
+
+ const vull __builtin_vunsignede_v4sf (vf);
+ VEC_VUNSIGNEDE_V4SF vunsignede_v4sf {}
+
+ const vull __builtin_vunsignedo_v4sf (vf);
+ VEC_VUNSIGNEDO_V4SF vunsignedo_v4sf {}
const vd __builtin_vsx_xvcvsxddp (vsll);
XVCVSXDDP vsx_floatv2div2df2 {}
[VEC_SIGNEDE, vec_signede, __builtin_vec_vsignede]
vsi __builtin_vec_vsignede (vd);
VEC_VSIGNEDE_V2DF
+ vsll __builtin_vec_vsignede (vf);
+ VEC_VSIGNEDE_V4SF
[VEC_SIGNEDO, vec_signedo, __builtin_vec_vsignedo]
vsi __builtin_vec_vsignedo (vd);
VEC_VSIGNEDO_V2DF
+ vsll __builtin_vec_vsignedo (vf);
+ VEC_VSIGNEDO_V4SF
[VEC_SIGNEXTI, vec_signexti, __builtin_vec_signexti]
vsi __builtin_vec_signexti (vsc);
[VEC_UNSIGNEDE, vec_unsignede, __builtin_vec_vunsignede]
vui __builtin_vec_vunsignede (vd);
VEC_VUNSIGNEDE_V2DF
+ vull __builtin_vec_vunsignede (vf);
+ VEC_VUNSIGNEDE_V4SF
[VEC_UNSIGNEDO, vec_unsignedo, __builtin_vec_vunsignedo]
vui __builtin_vec_vunsignedo (vd);
VEC_VUNSIGNEDO_V2DF
+ vull __builtin_vec_vunsignedo (vf);
+ VEC_VUNSIGNEDO_V4SF
[VEC_VEE, vec_extract_exp, __builtin_vec_extract_exp]
vui __builtin_vec_extract_exp (vf);
DONE;
})
+;; Convert float vector even elements to signed long long vector
+(define_expand "vsignede_v4sf"
+ [(match_operand:V2DI 0 "vsx_register_operand")
+ (match_operand:V4SF 1 "vsx_register_operand")]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ emit_insn (gen_vsx_xvcvspsxds_be (operands[0], operands[1]));
+ else
+ {
+ /* Shift left one word to put even word in correct location. */
+ rtx rtx_tmp = gen_reg_rtx (V4SFmode);
+ rtx rtx_val = GEN_INT (4);
+ emit_insn (gen_altivec_vsldoi_v4sf (rtx_tmp, operands[1], operands[1],
+ rtx_val));
+ emit_insn (gen_vsx_xvcvspsxds_le (operands[0], rtx_tmp));
+ }
+
+ DONE;
+})
+
+;; Convert float vector odd elements to signed long long vector
+(define_expand "vsignedo_v4sf"
+ [(match_operand:V2DI 0 "vsx_register_operand")
+ (match_operand:V4SF 1 "vsx_register_operand")]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ {
+ /* Shift left one word to put even word in correct location. */
+ rtx rtx_tmp = gen_reg_rtx (V4SFmode);
+ rtx rtx_val = GEN_INT (4);
+ emit_insn (gen_altivec_vsldoi_v4sf (rtx_tmp, operands[1], operands[1],
+ rtx_val));
+ emit_insn (gen_vsx_xvcvspsxds_be (operands[0], rtx_tmp));
+ }
+ else
+ emit_insn (gen_vsx_xvcvspsxds_le (operands[0], operands[1]));
+
+ DONE;
+})
+
+;; Convert float vector of even vector elements to unsigned long long vector
+(define_expand "vunsignede_v4sf"
+ [(match_operand:V2DI 0 "vsx_register_operand")
+ (match_operand:V4SF 1 "vsx_register_operand")]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ emit_insn (gen_vsx_xvcvspuxds_be (operands[0], operands[1]));
+ else
+ {
+ /* Shift left one word to put even word in correct location. */
+ rtx rtx_tmp = gen_reg_rtx (V4SFmode);
+ rtx rtx_val = GEN_INT (4);
+ emit_insn (gen_altivec_vsldoi_v4sf (rtx_tmp, operands[1], operands[1],
+ rtx_val));
+ emit_insn (gen_vsx_xvcvspuxds_le (operands[0], rtx_tmp));
+ }
+
+ DONE;
+})
+
+;; Convert float vector of odd elements to unsigned long long vector
+(define_expand "vunsignedo_v4sf"
+ [(match_operand:V2DI 0 "vsx_register_operand")
+ (match_operand:V4SF 1 "vsx_register_operand")]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+{
+ if (BYTES_BIG_ENDIAN)
+ {
+ /* Shift left one word to put even word in correct location. */
+ rtx rtx_tmp = gen_reg_rtx (V4SFmode);
+ rtx rtx_val = GEN_INT (4);
+ emit_insn (gen_altivec_vsldoi_v4sf (rtx_tmp, operands[1], operands[1],
+ rtx_val));
+ emit_insn (gen_vsx_xvcvspuxds_be (operands[0], rtx_tmp));
+ }
+ else
+ emit_insn (gen_vsx_xvcvspuxds_le (operands[0], operands[1]));
+
+ DONE;
+})
+
;; Generate float2 double
;; convert two double to float
(define_expand "float2_v2df"
@samp{vec_vsx_st} built-in functions always generate the VSX @samp{LXVD2X},
@samp{LXVW4X}, @samp{STXVD2X}, and @samp{STXVW4X} instructions.
+@smallexample
+vector signed long long vec_signedo (vector float);
+vector signed long long vec_signede (vector float);
+vector unsigned long long vec_unsignedo (vector float);
+vector unsigned long long vec_unsignede (vector float);
+@end smallexample
+
+The overloaded built-ins @code{vec_signedo} and @code{vec_signede} are
+additional extensions to the built-ins as documented in the PVIPR.
+
@node PowerPC AltiVec Built-in Functions Available on ISA 2.07
@subsubsection PowerPC AltiVec Built-in Functions Available on ISA 2.07
}
void test_ll_int_result(vector long long int vec_result,
- vector long long int vec_expected)
+ vector long long int vec_expected,
+ char *string)
{
int i;
for (i = 0; i < 2; i++)
if (vec_result[i] != vec_expected[i]) {
#ifdef DEBUG
- printf("Test_ll_int_result: ");
+ printf("Test_ll_int_result %s: ", string);
printf("vec_result[%d] (%lld) != vec_expected[%d] (%lld)\n",
i, vec_result[i], i, vec_expected[i]);
#else
}
void test_ll_unsigned_int_result(vector long long unsigned int vec_result,
- vector long long unsigned int vec_expected)
+ vector long long unsigned int vec_expected,
+ char *string)
{
int i;
for (i = 0; i < 2; i++)
if (vec_result[i] != vec_expected[i]) {
#ifdef DEBUG
- printf("Test_ll_unsigned_int_result: ");
+ printf("Test_ll_unsigned_int_result %s: ", string);
printf("vec_result[%d] (%lld) != vec_expected[%d] (%lld)\n",
i, vec_result[i], i, vec_expected[i]);
#else
vec_dble0 = (vector double){-124.930, 81234.49};
vec_ll_int_expected = (vector long long signed int){-124, 81234};
vec_ll_int_result = vec_signed (vec_dble0);
- test_ll_int_result (vec_ll_int_result, vec_ll_int_expected);
+ test_ll_int_result (vec_ll_int_result, vec_ll_int_expected,
+ "vec_signed");
/* Convert double precision vector float to vector int, even words */
vec_dble0 = (vector double){-124.930, 81234.49};
test_unsigned_int_result (ALL, vec_uns_int_result,
vec_uns_int_expected);
+ /* Convert single precision vector float, even args, to vector
+ signed long long int. */
+ vec_flt0 = (vector float){14.930, 834.49, -3.3, -5.4};
+ vec_ll_int_expected = (vector signed long long int){14, -3};
+ vec_ll_int_result = vec_signede (vec_flt0);
+ test_ll_int_result (vec_ll_int_result, vec_ll_int_expected,
+ "vec_signede");
+
+ /* Convert single precision vector float, odd args, to vector
+ signed long long int. */
+ vec_flt0 = (vector float){14.930, 834.49, -3.3, -5.4};
+ vec_ll_int_expected = (vector signed long long int){834, -5};
+ vec_ll_int_result = vec_signedo (vec_flt0);
+ test_ll_int_result (vec_ll_int_result, vec_ll_int_expected,
+ "vec_signedo");
+
+ /* Convert single precision vector float, even args, to vector
+ unsigned long long int. */
+ vec_flt0 = (vector float){14.930, 834.49, -3.3, -5.4};
+ vec_ll_uns_int_expected = (vector unsigned long long int){14, 0};
+ vec_ll_uns_int_result = vec_unsignede (vec_flt0);
+ test_ll_unsigned_int_result (vec_ll_uns_int_result,
+ vec_ll_uns_int_expected, "vec_unsignede");
+
+ /* Convert single precision vector float, odd args, to vector
+ unsigned long long int. */
+ vec_flt0 = (vector float){14.930, 834.49, -3.3, -5.4};
+ vec_ll_uns_int_expected = (vector unsigned long long int){834, 0};
+ vec_ll_uns_int_result = vec_unsignedo (vec_flt0);
+ test_ll_unsigned_int_result (vec_ll_uns_int_result,
+ vec_ll_uns_int_expected, "vec_unsignedo");
+
/* Convert double precision float to long long unsigned int */
vec_dble0 = (vector double){124.930, 8134.49};
vec_ll_uns_int_expected = (vector long long unsigned int){124, 8134};
vec_ll_uns_int_result = vec_unsigned (vec_dble0);
test_ll_unsigned_int_result (vec_ll_uns_int_result,
- vec_ll_uns_int_expected);
+ vec_ll_uns_int_expected, "vec_unsigned");
/* Convert double precision float to long long unsigned int. Negative
arguments. */
vec_ll_uns_int_expected = (vector long long unsigned int){0, 0};
vec_ll_uns_int_result = vec_unsigned (vec_dble0);
test_ll_unsigned_int_result (vec_ll_uns_int_result,
- vec_ll_uns_int_expected);
+ vec_ll_uns_int_expected, "vec_unsigned");
/* Convert double precision vector float to vector unsigned int,
even words. Negative arguments */