/// lower 8 values are used.
Value *Builder::PMOVSXBD(Value* a)
{
- Value* res;
+ // llvm-3.9 removed the pmovsxbd intrinsic
+#if HAVE_LLVM < 0x309
// use avx2 byte sign extend instruction if available
if(JM()->mArch.AVX2())
{
- res = VPMOVSXBD(a);
+ Function *pmovsxbd = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::x86_avx2_pmovsxbd);
+ return CALL(pmovsxbd, std::initializer_list<Value*>{a});
}
else
+#endif
{
// VPMOVSXBD output type
Type* v8x32Ty = VectorType::get(mInt32Ty, 8);
// Extract 8 values from 128bit lane and sign extend
- res = S_EXT(VSHUFFLE(a, a, C<int>({0, 1, 2, 3, 4, 5, 6, 7})), v8x32Ty);
+ return S_EXT(VSHUFFLE(a, a, C<int>({0, 1, 2, 3, 4, 5, 6, 7})), v8x32Ty);
}
- return res;
}
//////////////////////////////////////////////////////////////////////////
/// @param a - 128bit SIMD lane(8x16bit) of 16bit integer values.
Value *Builder::PMOVSXWD(Value* a)
{
- Value* res;
+ // llvm-3.9 removed the pmovsxwd intrinsic
+#if HAVE_LLVM < 0x309
// use avx2 word sign extend if available
if(JM()->mArch.AVX2())
{
- res = VPMOVSXWD(a);
+ Function *pmovsxwd = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::x86_avx2_pmovsxwd);
+ return CALL(pmovsxwd, std::initializer_list<Value*>{a});
}
else
+#endif
{
// VPMOVSXWD output type
Type* v8x32Ty = VectorType::get(mInt32Ty, 8);
// Extract 8 values from 128bit lane and sign extend
- res = S_EXT(VSHUFFLE(a, a, C<int>({0, 1, 2, 3, 4, 5, 6, 7})), v8x32Ty);
+ return S_EXT(VSHUFFLE(a, a, C<int>({0, 1, 2, 3, 4, 5, 6, 7})), v8x32Ty);
}
- return res;
}
//////////////////////////////////////////////////////////////////////////
Value *Builder::PMAXSD(Value* a, Value* b)
{
+ // llvm-3.9 removed the pmax intrinsics
+#if HAVE_LLVM >= 0x309
+ Value* cmp = ICMP_SGT(a, b);
+ return SELECT(cmp, a, b);
+#else
if (JM()->mArch.AVX2())
{
- return VPMAXSD(a, b);
+ Function* pmaxsd = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::x86_avx2_pmaxs_d);
+ return CALL(pmaxsd, {a, b});
}
else
{
return result;
}
+#endif
}
Value *Builder::PMINSD(Value* a, Value* b)
{
+ // llvm-3.9 removed the pmin intrinsics
+#if HAVE_LLVM >= 0x309
+ Value* cmp = ICMP_SLT(a, b);
+ return SELECT(cmp, a, b);
+#else
if (JM()->mArch.AVX2())
{
- return VPMINSD(a, b);
+ Function* pminsd = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::x86_avx2_pmins_d);
+ return CALL(pminsd, {a, b});
}
else
{
return result;
}
+#endif
}
void Builder::Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets,
["VRCPPS", "x86_avx_rcp_ps_256", ["a"]],
["VMINPS", "x86_avx_min_ps_256", ["a", "b"]],
["VMAXPS", "x86_avx_max_ps_256", ["a", "b"]],
- ["VPMINSD", "x86_avx2_pmins_d", ["a", "b"]],
- ["VPMAXSD", "x86_avx2_pmaxs_d", ["a", "b"]],
["VROUND", "x86_avx_round_ps_256", ["a", "rounding"]],
["VCMPPS", "x86_avx_cmp_ps_256", ["a", "b", "cmpop"]],
["VBLENDVPS", "x86_avx_blendv_ps_256", ["a", "b", "mask"]],
["VMASKLOADD", "x86_avx2_maskload_d_256", ["src", "mask"]],
["VMASKMOVPS", "x86_avx_maskload_ps_256", ["src", "mask"]],
["VPSHUFB", "x86_avx2_pshuf_b", ["a", "b"]],
- ["VPMOVSXBD", "x86_avx2_pmovsxbd", ["a"]], # sign extend packed 8bit components
- ["VPMOVSXWD", "x86_avx2_pmovsxwd", ["a"]], # sign extend packed 16bit components
["VPERMD", "x86_avx2_permd", ["a", "idx"]],
["VPERMPS", "x86_avx2_permps", ["idx", "a"]],
["VCVTPH2PS", "x86_vcvtph2ps_256", ["a"]],
["VPTESTC", "x86_avx_ptestc_256", ["a", "b"]],
["VPTESTZ", "x86_avx_ptestz_256", ["a", "b"]],
["VFMADDPS", "x86_fma_vfmadd_ps_256", ["a", "b", "c"]],
- ["VCVTTPS2DQ", "x86_avx_cvtt_ps2dq_256", ["a"]],
["VMOVMSKPS", "x86_avx_movmsk_ps_256", ["a"]],
["INTERRUPT", "x86_int", ["a"]],
]