[PowerPC] Implement vector_insert_exp builtins - clang portion

This patch corresponds to review https://reviews.llvm.org/D25956.
Committing on behalf of Zaara Syeda.

llvm-svn: 285229
This commit is contained in:
Nemanja Ivanovic 2016-10-26 19:27:11 +00:00
parent 01969218a4
commit 3de0a385c9
3 changed files with 51 additions and 0 deletions

View File

@ -362,6 +362,9 @@ BUILTIN(__builtin_vsx_xvcpsgnsp, "V4fV4fV4f", "")
BUILTIN(__builtin_vsx_xvabssp, "V4fV4f", "") BUILTIN(__builtin_vsx_xvabssp, "V4fV4f", "")
BUILTIN(__builtin_vsx_xvabsdp, "V2dV2d", "") BUILTIN(__builtin_vsx_xvabsdp, "V2dV2d", "")
BUILTIN(__builtin_vsx_xviexpdp, "V2dV2ULLiV2ULLi", "")
BUILTIN(__builtin_vsx_xviexpsp, "V4fV4UiV4Ui", "")
// HTM builtins // HTM builtins
BUILTIN(__builtin_tbegin, "UiUIi", "") BUILTIN(__builtin_tbegin, "UiUIi", "")
BUILTIN(__builtin_tend, "UiUIi", "") BUILTIN(__builtin_tend, "UiUIi", "")

View File

@ -2497,6 +2497,26 @@ vec_first_mismatch_or_eos_index(vector unsigned int __a,
return __res[0] >> 5; return __res[0] >> 5;
} }
static __inline__ vector double __ATTRS_o_ai
vec_insert_exp(vector double __a, vector unsigned long long __b) {
return __builtin_vsx_xviexpdp((vector unsigned long long)__a,__b);
}
static __inline__ vector double __ATTRS_o_ai
vec_insert_exp(vector unsigned long long __a, vector unsigned long long __b) {
return __builtin_vsx_xviexpdp(__a,__b);
}
static __inline__ vector float __ATTRS_o_ai
vec_insert_exp(vector float __a, vector unsigned int __b) {
return __builtin_vsx_xviexpsp((vector unsigned int)__a,__b);
}
static __inline__ vector float __ATTRS_o_ai
vec_insert_exp(vector unsigned int __a, vector unsigned int __b) {
return __builtin_vsx_xviexpsp(__a,__b);
}
#endif #endif
/* vec_cpsgn */ /* vec_cpsgn */

View File

@ -698,3 +698,31 @@ vector unsigned short test54(void) {
// CHECK-NEXT: ret <8 x i16> // CHECK-NEXT: ret <8 x i16>
return vec_popcnt (vusa); return vec_popcnt (vusa);
} }
vector double test55(void) {
// CHECK-BE: @llvm.ppc.vsx.xviexpdp(<2 x i64> %{{.+}}, <2 x i64>
// CHECK-BE-NEXT: ret <2 x double>
// CHECK: @llvm.ppc.vsx.xviexpdp(<2 x i64> %{{.+}}, <2 x i64>
// CHECK-NEXT: ret <2 x double>
return vec_insert_exp (vda,vulb);
}
vector double test56(void) {
// CHECK-BE: @llvm.ppc.vsx.xviexpdp(<2 x i64> %{{.+}}, <2 x i64>
// CHECK-BE-NEXT: ret <2 x double>
// CHECK: @llvm.ppc.vsx.xviexpdp(<2 x i64> %{{.+}}, <2 x i64>
// CHECK-NEXT: ret <2 x double>
return vec_insert_exp (vula, vulb);
}
vector float test57(void) {
// CHECK-BE: @llvm.ppc.vsx.xviexpsp(<4 x i32> %{{.+}}, <4 x i32>
// CHECK-BE-NEXT: ret <4 x float>
// CHECK: @llvm.ppc.vsx.xviexpsp(<4 x i32> %{{.+}}, <4 x i32>
// CHECK-NEXT: ret <4 x float>
return vec_insert_exp (vfa,vuib);
}
vector float test58(void) {
// CHECK-BE: @llvm.ppc.vsx.xviexpsp(<4 x i32> %{{.+}}, <4 x i32>
// CHECK-BE-NEXT: ret <4 x float>
// CHECK: @llvm.ppc.vsx.xviexpsp(<4 x i32> %{{.+}}, <4 x i32>
// CHECK-NEXT: ret <4 x float>
return vec_insert_exp (vuia,vuib);
}