@@ -30,6 +30,7 @@ pub enum LibmCustomIntrinsic {
3030 Tgamma ,
3131 Log1p ,
3232 NextAfter ,
33+ Powi ,
3334 Remainder ,
3435 RemQuo ,
3536 Scalbn ,
@@ -157,6 +158,7 @@ pub const TABLE: &[(&str, LibmIntrinsic)] = &[
157158 ) ,
158159 ( "pow" , LibmIntrinsic :: GLOp ( GLOp :: Pow ) ) ,
159160 ( "powf" , LibmIntrinsic :: GLOp ( GLOp :: Pow ) ) ,
161+ ( "powi" , LibmIntrinsic :: Custom ( LibmCustomIntrinsic :: Powi ) ) ,
160162 (
161163 "remainder" ,
162164 LibmIntrinsic :: Custom ( LibmCustomIntrinsic :: Remainder ) ,
@@ -306,6 +308,12 @@ impl Builder<'_, '_> {
306308 LibmIntrinsic :: Custom ( LibmCustomIntrinsic :: NextAfter ) => {
307309 self . undef_zombie ( result_type, "NextAfter not supported yet" )
308310 }
311+ LibmIntrinsic :: Custom ( LibmCustomIntrinsic :: Powi ) => {
312+ assert_eq ! ( args. len( ) , 2 ) ;
313+ // Convert integer exponent to float, then use GLOp::Pow
314+ let float_exp = self . sitofp ( args[ 1 ] , args[ 0 ] . ty ) ;
315+ self . gl_op ( GLOp :: Pow , result_type, [ args[ 0 ] , float_exp] )
316+ }
309317 LibmIntrinsic :: Custom ( LibmCustomIntrinsic :: Remainder ) => {
310318 self . undef_zombie ( result_type, "Remainder not supported yet" )
311319 }
0 commit comments