Skip to content

Commit bd15d75

Browse files
authored
Translate llvm.exp10.* intrinsics (#3766)
1 parent 06bd160 commit bd15d75

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

lib/SPIRV/SPIRVUtil.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,7 @@ bool checkTypeForSPIRVExtendedInstLowering(IntrinsicInst *II, SPIRVModule *BM) {
19581958
case Intrinsic::cosh:
19591959
case Intrinsic::exp:
19601960
case Intrinsic::exp2:
1961+
case Intrinsic::exp10:
19611962
case Intrinsic::fabs:
19621963
case Intrinsic::floor:
19631964
case Intrinsic::fma:

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4095,6 +4095,7 @@ bool LLVMToSPIRVBase::isKnownIntrinsic(Intrinsic::ID Id) {
40954095
case Intrinsic::cos:
40964096
case Intrinsic::exp:
40974097
case Intrinsic::exp2:
4098+
case Intrinsic::exp10:
40984099
case Intrinsic::fabs:
40994100
case Intrinsic::floor:
41004101
case Intrinsic::fma:
@@ -4223,6 +4224,8 @@ static SPIRVWord getBuiltinIdForIntrinsic(Intrinsic::ID IID) {
42234224
return OpenCLLIB::Exp;
42244225
case Intrinsic::exp2:
42254226
return OpenCLLIB::Exp2;
4227+
case Intrinsic::exp10:
4228+
return OpenCLLIB::Exp10;
42264229
case Intrinsic::fabs:
42274230
return OpenCLLIB::Fabs;
42284231
case Intrinsic::floor:
@@ -4287,6 +4290,8 @@ static SPIRVWord getNativeBuiltinIdForIntrinsic(Intrinsic::ID IID) {
42874290
return OpenCLLIB::Native_exp;
42884291
case Intrinsic::exp2:
42894292
return OpenCLLIB::Native_exp2;
4293+
case Intrinsic::exp10:
4294+
return OpenCLLIB::Native_exp10;
42904295
case Intrinsic::log:
42914296
return OpenCLLIB::Native_log;
42924297
case Intrinsic::log10:
@@ -4425,6 +4430,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
44254430
case Intrinsic::cosh:
44264431
case Intrinsic::exp:
44274432
case Intrinsic::exp2:
4433+
case Intrinsic::exp10:
44284434
case Intrinsic::fabs:
44294435
case Intrinsic::floor:
44304436
case Intrinsic::log:

test/llvm-intrinsics/fp-intrinsics.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,18 @@ entry:
150150

151151
declare float @llvm.exp2.f32(float)
152152

153+
; CHECK: Function
154+
; CHECK: ExtInst [[var1]] {{[0-9]+}} [[extinst_id]] exp10
155+
; CHECK: FunctionEnd
156+
157+
define spir_func float @TestExp10(float %x) local_unnamed_addr {
158+
entry:
159+
%t = tail call float @llvm.exp10.f32(float %x)
160+
ret float %t
161+
}
162+
163+
declare float @llvm.exp10.f32(float)
164+
153165
; CHECK: Function
154166
; CHECK: ExtInst [[var1]] {{[0-9]+}} [[extinst_id]] log
155167
; CHECK: FunctionEnd

0 commit comments

Comments
 (0)