Skip to content

Commit 5aaacd7

Browse files
[CodeGen] Demand llvm.copysign.f{16,32,64,80,128} lowers without libcalls
This makes real what is already true: Copysign does not ever need to lower to runtime libcalls! Its operation should be possible to always implement via bitops.
1 parent 7745181 commit 5aaacd7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/lib/CodeGen/IntrinsicLowering.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,15 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) {
438438
break;
439439
}
440440
case Intrinsic::copysign: {
441-
ReplaceFPIntrinsicWithCall(CI, "copysignf", "copysign", "copysignl");
441+
switch (CI->getArgOperand(0)->getType()->getTypeID()) {
442+
default:
443+
report_fatal_error("copysign intrinsic without arch-specific floats "
444+
"reached intrinsic-to-libcall lowering");
445+
break;
446+
case Type::PPC_FP128TyID:
447+
ReplaceCallWith("copysignl", CI, CI->arg_begin(), CI->arg_end(),
448+
Type::getFloatTy(CI->getContext()));
449+
}
442450
break;
443451
}
444452
case Intrinsic::get_rounding:

0 commit comments

Comments
 (0)