Index: src/IceTargetLoweringX8632.cpp |
diff --git a/src/IceTargetLoweringX8632.cpp b/src/IceTargetLoweringX8632.cpp |
index 0576add554dd4fa18a98b822d0352596e5210586..8526d48c16261c3bd99628b561a5aaae52a468c0 100644 |
--- a/src/IceTargetLoweringX8632.cpp |
+++ b/src/IceTargetLoweringX8632.cpp |
@@ -2097,10 +2097,10 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
split64(Dest); |
const SizeT MaxSrcs = 1; |
Type SrcType = Inst->getSrc(0)->getType(); |
- InstCall *Call = makeHelperCall( |
- isFloat32Asserting32Or64(SrcType) ? "cvtftosi64" : "cvtdtosi64", Dest, |
- MaxSrcs); |
- // TODO: Call the correct compiler-rt helper function. |
+ InstCall *Call = makeHelperCall(isFloat32Asserting32Or64(SrcType) |
+ ? "__Sz_fptosi_f32_i64" |
Mircea Trofin
2015/02/28 00:45:35
Do we expect to use these strings anywhere else, s
Jim Stichnoth
2015/02/28 02:35:44
Good point. It's likely that these and more will
Mircea Trofin
2015/02/28 03:28:56
Why would the use during lowering be faster?
Jim Stichnoth
2015/02/28 04:44:28
I'm assuming that copying a constant IceString (i.
|
+ : "__Sz_fptosi_f64_i64", |
+ Dest, MaxSrcs); |
Call->addArg(Inst->getSrc(0)); |
lowerCall(Call); |
} else { |
@@ -2120,7 +2120,7 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
assert(Dest->getType() == IceType_v4i32 && |
Inst->getSrc(0)->getType() == IceType_v4f32); |
const SizeT MaxSrcs = 1; |
- InstCall *Call = makeHelperCall("Sz_fptoui_v4f32", Dest, MaxSrcs); |
+ InstCall *Call = makeHelperCall("__Sz_fptoui_4xi32_f32", Dest, MaxSrcs); |
Call->addArg(Inst->getSrc(0)); |
lowerCall(Call); |
} else if (Dest->getType() == IceType_i64 || |
@@ -2130,11 +2130,16 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
const SizeT MaxSrcs = 1; |
Type DestType = Dest->getType(); |
Type SrcType = Inst->getSrc(0)->getType(); |
- IceString DstSubstring = (isInt32Asserting32Or64(DestType) ? "32" : "64"); |
- IceString SrcSubstring = (isFloat32Asserting32Or64(SrcType) ? "f" : "d"); |
- // Possibilities are cvtftoui32, cvtdtoui32, cvtftoui64, cvtdtoui64 |
- IceString TargetString = "cvt" + SrcSubstring + "toui" + DstSubstring; |
- // TODO: Call the correct compiler-rt helper function. |
+ IceString TargetString; |
+ if (isInt32Asserting32Or64(DestType)) { |
+ TargetString = isFloat32Asserting32Or64(SrcType) |
+ ? "__Sz_fptoui_f32_i32" |
+ : "__Sz_fptoui_f64_i32"; |
+ } else { |
+ TargetString = isFloat32Asserting32Or64(SrcType) |
+ ? "__Sz_fptoui_f32_i64" |
+ : "__Sz_fptoui_f64_i64"; |
+ } |
InstCall *Call = makeHelperCall(TargetString, Dest, MaxSrcs); |
Call->addArg(Inst->getSrc(0)); |
lowerCall(Call); |
@@ -2163,9 +2168,10 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
// Use a helper for x86-32. |
const SizeT MaxSrcs = 1; |
Type DestType = Dest->getType(); |
- InstCall *Call = makeHelperCall( |
- isFloat32Asserting32Or64(DestType) ? "cvtsi64tof" : "cvtsi64tod", |
- Dest, MaxSrcs); |
+ InstCall *Call = makeHelperCall(isFloat32Asserting32Or64(DestType) |
+ ? "__Sz_sitofp_i64_f32" |
+ : "__Sz_sitofp_i64_f64", |
+ Dest, MaxSrcs); |
// TODO: Call the correct compiler-rt helper function. |
Call->addArg(Inst->getSrc(0)); |
lowerCall(Call); |
@@ -2190,7 +2196,7 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
assert(Dest->getType() == IceType_v4f32 && |
Src0->getType() == IceType_v4i32); |
const SizeT MaxSrcs = 1; |
- InstCall *Call = makeHelperCall("Sz_uitofp_v4i32", Dest, MaxSrcs); |
+ InstCall *Call = makeHelperCall("__Sz_uitofp_4xi32_4xf32", Dest, MaxSrcs); |
Call->addArg(Src0); |
lowerCall(Call); |
} else if (Src0->getType() == IceType_i64 || |
@@ -2199,12 +2205,16 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
// i32 on x86-32. |
const SizeT MaxSrcs = 1; |
Type DestType = Dest->getType(); |
- IceString SrcSubstring = |
- (isInt32Asserting32Or64(Src0->getType()) ? "32" : "64"); |
- IceString DstSubstring = (isFloat32Asserting32Or64(DestType) ? "f" : "d"); |
- // Possibilities are cvtui32tof, cvtui32tod, cvtui64tof, cvtui64tod |
- IceString TargetString = "cvtui" + SrcSubstring + "to" + DstSubstring; |
- // TODO: Call the correct compiler-rt helper function. |
+ IceString TargetString; |
+ if (isInt32Asserting32Or64(Src0->getType())) { |
+ TargetString = isFloat32Asserting32Or64(DestType) |
+ ? "__Sz_uitofp_i32_f32" |
+ : "__Sz_uitofp_i32_f64"; |
+ } else { |
+ TargetString = isFloat32Asserting32Or64(DestType) |
+ ? "__Sz_uitofp_i64_f32" |
+ : "__Sz_uitofp_i64_f64"; |
+ } |
InstCall *Call = makeHelperCall(TargetString, Dest, MaxSrcs); |
Call->addArg(Src0); |
lowerCall(Call); |
@@ -2236,13 +2246,13 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
llvm_unreachable("Unexpected Bitcast dest type"); |
case IceType_i8: { |
assert(Src0->getType() == IceType_v8i1); |
- InstCall *Call = makeHelperCall("Sz_bitcast_v8i1_to_i8", Dest, 1); |
+ InstCall *Call = makeHelperCall("__Sz_bitcast_8xi1_i8", Dest, 1); |
Call->addArg(Src0); |
lowerCall(Call); |
} break; |
case IceType_i16: { |
assert(Src0->getType() == IceType_v16i1); |
- InstCall *Call = makeHelperCall("Sz_bitcast_v16i1_to_i16", Dest, 1); |
+ InstCall *Call = makeHelperCall("__Sz_bitcast_16xi1_i16", Dest, 1); |
Call->addArg(Src0); |
lowerCall(Call); |
} break; |
@@ -2330,7 +2340,7 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
} break; |
case IceType_v8i1: { |
assert(Src0->getType() == IceType_i8); |
- InstCall *Call = makeHelperCall("Sz_bitcast_i8_to_v8i1", Dest, 1); |
+ InstCall *Call = makeHelperCall("__Sz_bitcast_i8_8xi1", Dest, 1); |
Variable *Src0AsI32 = Func->makeVariable(stackSlotType()); |
// Arguments to functions are required to be at least 32 bits wide. |
lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0)); |
@@ -2339,7 +2349,7 @@ void TargetX8632::lowerCast(const InstCast *Inst) { |
} break; |
case IceType_v16i1: { |
assert(Src0->getType() == IceType_i16); |
- InstCall *Call = makeHelperCall("Sz_bitcast_i16_to_v16i1", Dest, 1); |
+ InstCall *Call = makeHelperCall("__Sz_bitcast_i16_16xi1", Dest, 1); |
Variable *Src0AsI32 = Func->makeVariable(stackSlotType()); |
// Arguments to functions are required to be at least 32 bits wide. |
lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0)); |