@@ -757,3 +757,44 @@ func.func @complex_sub_with_fmf(%lhs: complex<f32>, %rhs: complex<f32>) -> compl
757
757
// CHECK: %[[RESULT_IMAG:.*]] = arith.subf %[[IMAG_LHS]], %[[IMAG_RHS]] fastmath<nnan,contract> : f32
758
758
// CHECK: %[[RESULT:.*]] = complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : complex<f32>
759
759
// CHECK: return %[[RESULT]] : complex<f32>
760
+
761
+ // -----
762
+
763
+ // CHECK-LABEL: func @complex_exp_with_fmf
764
+ // CHECK-SAME: %[[ARG:.*]]: complex<f32>
765
+ func.func @complex_exp_with_fmf (%arg: complex <f32 >) -> complex <f32 > {
766
+ %exp = complex.exp %arg fastmath <nnan ,contract > : complex <f32 >
767
+ return %exp : complex <f32 >
768
+ }
769
+ // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex<f32>
770
+ // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex<f32>
771
+ // CHECK-DAG: %[[COS_IMAG:.*]] = math.cos %[[IMAG]] fastmath<nnan,contract> : f32
772
+ // CHECK-DAG: %[[EXP_REAL:.*]] = math.exp %[[REAL]] fastmath<nnan,contract> : f32
773
+ // CHECK-DAG: %[[RESULT_REAL:.]] = arith.mulf %[[EXP_REAL]], %[[COS_IMAG]] fastmath<nnan,contract> : f32
774
+ // CHECK-DAG: %[[SIN_IMAG:.*]] = math.sin %[[IMAG]] fastmath<nnan,contract> : f32
775
+ // CHECK-DAG: %[[RESULT_IMAG:.*]] = arith.mulf %[[EXP_REAL]], %[[SIN_IMAG]] fastmath<nnan,contract> : f32
776
+ // CHECK: %[[RESULT:.*]] = complex.create %[[RESULT_REAL]], %[[RESULT_IMAG]] : complex<f32>
777
+ // CHECK: return %[[RESULT]] : complex<f32>
778
+
779
+ // -----
780
+
781
+ // CHECK-LABEL: func.func @complex_expm1_with_fmf(
782
+ // CHECK-SAME: %[[ARG:.*]]: complex<f32>) -> complex<f32> {
783
+ func.func @complex_expm1_with_fmf (%arg: complex <f32 >) -> complex <f32 > {
784
+ %expm1 = complex.expm1 %arg fastmath <nnan ,contract > : complex <f32 >
785
+ return %expm1 : complex <f32 >
786
+ }
787
+ // CHECK: %[[REAL_I:.*]] = complex.re %[[ARG]] : complex<f32>
788
+ // CHECK: %[[IMAG_I:.*]] = complex.im %[[ARG]] : complex<f32>
789
+ // CHECK: %[[EXP:.*]] = math.exp %[[REAL_I]] fastmath<nnan,contract> : f32
790
+ // CHECK: %[[COS:.*]] = math.cos %[[IMAG_I]] fastmath<nnan,contract> : f32
791
+ // CHECK: %[[RES_REAL:.*]] = arith.mulf %[[EXP]], %[[COS]] fastmath<nnan,contract> : f32
792
+ // CHECK: %[[SIN:.*]] = math.sin %[[IMAG_I]] fastmath<nnan,contract> : f32
793
+ // CHECK: %[[RES_IMAG:.*]] = arith.mulf %[[EXP]], %[[SIN]] fastmath<nnan,contract> : f32
794
+ // CHECK: %[[RES_EXP:.*]] = complex.create %[[RES_REAL]], %[[RES_IMAG]] : complex<f32>
795
+ // CHECK: %[[REAL:.*]] = complex.re %[[RES_EXP]] : complex<f32>
796
+ // CHECK: %[[ONE:.*]] = arith.constant 1.000000e+00 : f32
797
+ // CHECK: %[[REAL_M1:.*]] = arith.subf %[[REAL]], %[[ONE]] fastmath<nnan,contract> : f32
798
+ // CHECK: %[[IMAG:.*]] = complex.im %[[RES_EXP]] : complex<f32>
799
+ // CHECK: %[[RES:.*]] = complex.create %[[REAL_M1]], %[[IMAG]] : complex<f32>
800
+ // CHECK: return %[[RES]] : complex<f32>
0 commit comments