/llvm-project/mlir/test/Dialect/Complex/ |
H A D | ops.mlir | 8 // CHECK: complex.constant [1.{{.*}}, -1.{{.*}}] : complex<f64> 9 %cst_f64 = complex.constant [0.1, -1.0] : complex<f64> 11 // CHECK: complex.constant [1.{{.*}} : f32, -1.{{.*}} : f32] : complex<f32> 12 %cst_f32 = complex.constant [0.1 : f32, -1.0 : f32] : complex<f32> 14 // CHECK: complex.constant [true, false] : complex<i1> 15 %cst_i1 = complex.constant [1 : i1, 0 : i1] : complex<i1> 17 // CHECK: %[[C:.*]] = complex.create %[[F]], %[[F]] : complex<f32> 18 %complex = complex.create %f, %f : complex<f32> 20 // CHECK: complex.re %[[C]] : complex<f32> 21 %real = complex.re %complex : complex<f32> [all …]
|
H A D | canonicalize.mlir | 4 // CHECK-SAME: (%[[CPLX:.*]]: complex<f32>) 5 func.func @create_of_real_and_imag(%cplx: complex<f32>) -> complex<f32> { 6 // CHECK-NEXT: return %[[CPLX]] : complex<f32> 7 %real = complex.re %cplx : complex<f32> 8 %imag = complex.im %cplx : complex<f32> 9 %complex = complex.create %real, %imag : complex<f32> 10 return %complex : complex<f32> 14 // CHECK-SAME: (%[[CPLX:.*]]: complex<f32>, %[[CPLX2:.*]]: complex<f32>) 16 %cplx: complex<f32>, %cplx2 : complex<f32>) -> complex<f32> { 17 // CHECK-NEXT: %[[REAL:.*]] = complex.re %[[CPLX]] : complex<f32> [all …]
|
/llvm-project/libcxx/test/std/numerics/complex.number/ |
H A D | cases.h | 22 TEST_CONSTEXPR_CXX20 const std::complex<double> testcases[] = 24 std::complex<double>( 1.e-6, 1.e-6), 25 std::complex<double>(-1.e-6, 1.e-6), 26 std::complex<double>(-1.e-6, -1.e-6), 27 std::complex<double>( 1.e-6, -1.e-6), 29 std::complex<double>( 1.e+6, 1.e-6), 30 std::complex<double>(-1.e+6, 1.e-6), 31 std::complex<double>(-1.e+6, -1.e-6), 32 std::complex<double>( 1.e+6, -1.e-6), 34 std::complex<double>( 1.e-6, 1.e+6), [all …]
|
/llvm-project/mlir/test/Conversion/ComplexToLibm/ |
H A D | convert-to-libm.mlir | 1 // RUN: mlir-opt %s -convert-complex-to-libm -canonicalize | FileCheck %s 3 // CHECK-DAG: @cpowf(complex<f32>, complex<f32>) -> complex<f32> 4 // CHECK-DAG: @cpow(complex<f64>, complex<f64>) -> complex<f64> 5 // CHECK-DAG: @csqrtf(complex<f32>) -> complex<f32> 6 // CHECK-DAG: @csqrt(complex<f64>) -> complex<f64> 7 // CHECK-DAG: @ctanhf(complex<f32>) -> complex<f32> 8 // CHECK-DAG: @ctanh(complex<f64>) -> complex<f64> 9 // CHECK-DAG: @ccos(complex<f64>) -> complex<f64> 10 // CHECK-DAG: @csin(complex<f64>) -> complex<f64> 11 // CHECK-DAG: @conj(complex<f64>) -> complex<f64> [all …]
|
/llvm-project/libcxx/include/ |
H A D | complex | 14 complex synopsis 20 class complex 25 complex(const T& re = T(), const T& im = T()); // constexpr in C++14 26 complex(const complex&); // constexpr in C++14 27 template<class X> complex(const complex<X>&); // constexpr in C++14 35 complex<T>& operator= (const T&); // constexpr in C++20 36 complex<T>& operator+=(const T&); // constexpr in C++20 37 complex< [all...] |
/llvm-project/flang/test/Fir/ |
H A D | undo-complex-pattern.fir | 1 // Test regrouping of + and - operations on complex components into complex operations 6 func.func @add(%z: !fir.ref<complex<f64>>, %z1 : complex<f64>, %z2 : complex<f64>) { 9 %real1 = fir.extract_value %z1, [0 : index] : (complex<f64>) -> f64 10 %imag1 = fir.extract_value %z1, [1 : index] : (complex<f64>) -> f64 11 %real2 = fir.extract_value %z2, [0 : index] : (complex<f64>) -> f64 12 %imag2 = fir.extract_value %z2, [1 : index] : (complex<f64>) -> f64 17 %undef = fir.undefined complex<f6 [all...] |
H A D | target-rewrite-complex16.fir | 5 // complex<16>. 6 func.func @returncomplex16() -> complex<f128> { 7 %1 = fir.undefined complex<f128> 11 %4 = fir.insert_value %1, %3, [0 : i32] : (complex<f128>, f128) -> complex<f128> 14 %6 = fir.insert_value %4, %5, [1 : i32] : (complex<f128>, f128) -> complex<f128> 15 return %6 : complex<f128> 18 // Test that we rewrite the signature of a func.function that accepts a complex<16>. 19 func.func private @paramcomplex16(complex<f12 [all...] |
H A D | target-rewrite-complex.fir | 14 // complex<4>. 25 func.func @returncomplex4() -> complex<f32> { 46 %1 = fir.undefined complex<f32> 50 %4 = fir.insert_value %1, %3, [0 : i32] : (complex<f32>, f32) -> complex<f32> 53 %6 = fir.insert_value %4, %5, [1 : i32] : (complex<f32>, f32) -> complex<f32> 56 // I32: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRI64]] : (!fir.ref<i64>) -> !fir.ref<complex<f32>> 57 // I32: fir.store [[VAL]] to [[ADDRC]] : !fir.ref<complex<f32>> 61 // I32_MINGW: [[ADDRC:%[0-9A-Za-z]+]] = fir.convert [[ADDRV]] : (!fir.ref<i64>) -> !fir.ref<complex<f3 [all...] |
H A D | target-rewrite-selective.fir | 1 // RUN: fir-opt --target-rewrite="target=x86_64-unknown-linux-gnu no-complex-conversion" %s | FileCheck --check-prefix=CMPLXOFF %s 4 // Verify that selective TargetRewrite with no-complex-conversion and 8 // complex function test(value) 10 // complex function test1(name, c) 12 // complex, value :: c 15 // complex, value :: c 18 // complex, value :: value 24 // CMPLXOFF-DAG: fir.call @_QPtest1({{.*}}, {{.*}}, {{.*}}) : (!fir.ref<!fir.char<1,?>>, complex<f32>, i64) -> complex<f32> 25 // CMPLXOFF-DAG: fir.call @_QPtest2({{.*}}, {{.*}}, {{.*}}) : (!fir.ref<!fir.char<1,10>>, index, complex<f3 [all...] |
/llvm-project/clang/lib/Headers/openmp_wrappers/ |
H A D | complex_cmath.h | 9 // std::complex header copied from the libcxx source and simplified for use in 34 template <class _Tp> __DEVICE__ _Tp abs(const std::complex<_Tp> &__c) { in abs() 40 template <class _Tp> __DEVICE__ _Tp arg(const std::complex<_Tp> &__c) { in arg() 58 template <class _Tp> __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) { in norm() 73 CXX20_CONSTEXPR_DEVICE std::complex<_Tp> conj(const std::complex<_Tp> &__c) { 74 return std::complex<_Tp>(__c.real(), -__c.imag()); in proj() 79 template <class _Tp> std::complex<_Tp> proj(const std::complex<_Tp> &__c) { in proj() 80 std::complex<_T in proj() [all...] |
/llvm-project/mlir/test/Integration/Dialect/Complex/CPU/ |
H A D | correctness.mlir | 3 // RUN: -convert-scf-to-cf --convert-complex-to-standard \ 5 // RUN: -convert-vector-to-llvm -convert-complex-to-llvm \ 14 %func: (complex<f32>) -> complex<f32>) { 22 %val = func.call_indirect %func(%elem) : (complex<f32>) -> complex<f32> 23 %real = complex.re %val : complex<f32> 24 %imag = complex.im %val: complex<f3 [all...] |
/llvm-project/clang/test/Headers/Inputs/include/ |
H A D | complex | 12 class complex { 21 complex(const value_type &__re = value_type(), const value_type &__im = value_type()) 24 complex(const complex<_Xp> &__c) 33 complex &operator=(const value_type &__re) { 38 complex &operator+=(const value_type &__re) { 42 complex &operator-=(const value_type &__re) { 46 complex &operator*=(const value_type &__re) { 51 complex &operator/=(const value_type &__re) { 58 complex &operator=(const complex<_Xp> &__c) { 64 complex &operator+=(const complex<_Xp> &__c) { [all …]
|
/llvm-project/mlir/include/mlir/Dialect/Complex/IR/ |
H A D | ComplexOps.td | 22 // Base class for standard arithmetic operations on complex numbers with a 24 // one result, all of which must be complex numbers of the same type. 34 // Base class for standard unary operations on complex numbers with a 36 // one result; the operand must be a complex number. 39 let arguments = (ins Complex<AnyFloat>:$complex, DefaultValuedAttr< 41 let assemblyFormat = "$complex (`fastmath` `` $fastmath^)? attr-dict `:` type($complex)"; 49 [TypesMatchWith<"complex element type matches result type", 50 "complex", "result", 52 let summary = "computes absolute value of a complex number"; 54 The `abs` op takes a single complex number and computes its absolute value. [all …]
|
/llvm-project/libcxx/test/std/numerics/complex.number/complex.ops/ |
H A D | stream_input.pass.cpp | 27 std::complex<double> c; in main() 29 assert(c == std::complex<double>(5, 0)); in main() 34 std::complex<double> c; in main() 36 assert(c == std::complex<double>(5, 0)); in main() 41 std::complex<double> c; in main() 43 assert(c == std::complex<double>(5, 0)); in main() 48 std::complex<double> c; in main() 50 assert(c == std::complex<double>(0, 0)); in main() 55 std::complex<double> c; in main() 57 assert(c == std::complex<double>(5.5, 0)); in main() [all …]
|
/llvm-project/mlir/test/Conversion/ComplexToLLVM/ |
H A D | convert-to-llvm.mlir | 1 // RUN: mlir-opt %s -convert-complex-to-llvm | FileCheck %s 5 // RUN: mlir-opt --convert-to-llvm="filter-dialects=complex" --split-input-file %s | FileCheck %s 12 func.func @complex_create(%real: f32, %imag: f32) -> complex<f32> { 13 %cplx2 = complex.create %real, %imag : complex<f32> 14 return %cplx2 : complex<f32> 19 func.func @complex_constant() -> complex<f64> { 20 %cplx2 = complex.constant [1.000000e+00, 2.000000e+00] : complex<f64> 21 return %cplx2 : complex<f64> 25 // CHECK-SAME: (%[[CPLX:.*]]: complex<f32>) 26 // CHECK-NEXT: %[[CAST0:.*]] = builtin.unrealized_conversion_cast %[[CPLX]] : complex<f32> to !l… [all …]
|
/llvm-project/flang/test/Transforms/ |
H A D | debug-complex-1.fir | 3 // check conversion of complex type of different size. Both fir and mlir 7 func.func @test1(%x : complex<f32>) -> complex<f64> { 8 %1 = fir.convert %x : (complex<f32>) -> complex<f64> 9 return %1 : complex<f64> 11 func.func @test2(%x : complex<f32>) -> complex<f64> { 12 %1 = fir.convert %x : (complex<f32>) -> complex<f6 [all...] |
/llvm-project/mlir/test/Conversion/ComplexToStandard/ |
H A D | convert-to-standard.mlir | 1 // RUN: mlir-opt %s --convert-complex-to-standard --split-input-file |\ 5 // CHECK-SAME: %[[ARG:.*]]: complex<f32> 6 func.func @complex_abs(%arg: complex<f32>) -> f32 { 7 %abs = complex.abs %arg: complex<f32> 11 // CHECK: %[[REAL:.*]] = complex.re %[[ARG]] : complex<f32> 12 // CHECK: %[[IMAG:.*]] = complex.im %[[ARG]] : complex<f32> 30 func.func @complex_atan2(%lhs: complex<f3 [all...] |
/llvm-project/mlir/test/Conversion/ComplexToSPIRV/ |
H A D | complex-to-spirv.mlir | 1 // RUN: mlir-opt -split-input-file -convert-complex-to-spirv %s | FileCheck %s 3 func.func @create_complex(%real: f32, %imag: f32) -> complex<f32> { 4 %0 = complex.create %real, %imag : complex<f32> 5 return %0 : complex<f32> 11 … CHECK: %[[CAST:.+]] = builtin.unrealized_conversion_cast %[[CC]] : vector<2xf32> to complex<f32> 12 // CHECK: return %[[CAST]] : complex<f32> 17 func.func @real_number(%arg: complex<f32>) -> f32 { 18 %real = complex.re %arg : complex<f32> 23 // CHECK-SAME: %[[ARG:.+]]: complex<f32> 24 // CHECK: %[[CAST:.+]] = builtin.unrealized_conversion_cast %[[ARG]] : complex<f32> to vect… [all …]
|
/llvm-project/flang/docs/ |
H A D | ComplexOperations.md | 9 Fortran includes support for complex number types and a set of operators and 14 complex dialect while avoiding cross-platform ABI issues. 18 MLIR contains a complex dialect, similar to the Math dialect also used for 20 fir.complex types and MLIR complex types is supported. 22 As a result at the FIR level, complex operations can be represented as 23 conversions from the fir.complex type to the equivalent MLIR complex type, use 31 complex, intent(in) :: c 32 complex :: pow_self 39 func.func @_QPpow_self(%arg0: !fir.ref<!fir.complex<4>>) -> !fir.complex<4> { 40 %0 = fir.alloca !fir.complex<4> [all …]
|
/llvm-project/flang/test/HLFIR/ |
H A D | designate-codegen-complex-part.fir | 2 // with complex parts. 5 func.func @test_set_scalar(%arg0: !fir.ref<complex<f32>>, %arg1: !fir.ref<f32>) { 6 %0:2 = hlfir.declare %arg0 {uniq_name = "a"} : (!fir.ref<complex<f32>>) -> (!fir.ref<complex<f32>>, !fir.ref<complex<f32>>) 9 %3 = hlfir.designate %0#0 imag : (!fir.ref<complex<f32>>) -> !fir.ref<f32> 14 // CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<complex<f32>>, %[[VAL_1:.*]]: !fir.ref<f32>) { 15 // CHECK: %[[VAL_2:.*]] = fir.declare %[[VAL_0]] {uniq_name = "a"} : (!fir.ref<complex<f32>>) -> !fir.ref<complex<f32>> 19 // CHECK: %[[VAL_6:.*]] = fir.coordinate_of %[[VAL_2]], %[[VAL_5]] : (!fir.ref<complex<f3 [all...] |
/llvm-project/mlir/test/Dialect/IRDL/ |
H A D | test-cmath.mlir | 4 …// CHECK: func.func @conorm(%[[p:[^:]*]]: !cmath.complex<f32>, %[[q:[^:]*]]: !cmath.complex<f32>) … 5 // CHECK: %[[norm_p:[^ ]*]] = "cmath.norm"(%[[p]]) : (!cmath.complex<f32>) -> f32 6 // CHECK: %[[norm_q:[^ ]*]] = "cmath.norm"(%[[q]]) : (!cmath.complex<f32>) -> f32 10 func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 { 11 %norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32 12 %norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32 17 …// CHECK: func.func @conorm2(%[[p:[^:]*]]: !cmath.complex<f32>, %[[q:[^:]*]]: !cmath.complex<f32>)… 18 …q:[^ ]*]] = "cmath.mul"(%[[p]], %[[q]]) : (!cmath.complex<f32>, !cmath.complex<f32>) -> !cmath.com… 19 // CHECK: %[[conorm:[^ ]*]] = "cmath.norm"(%[[pq]]) : (!cmath.complex<f32>) -> f32 22 func.func @conorm2(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 { [all …]
|
/llvm-project/offload/test/offloading/ |
H A D | std_complex_arithmetic.cpp | 16 std::complex<T> a(0.2, 1), a_check; in test_map() 24 std::complex<RT> c, c_host; in test_plus() 34 std::complex<RT> c, c_host; in test_minus() 44 std::complex<RT> c, c_host; in test_mul() 54 std::complex<RT> c, c_host; in test_div() 66 test_plus<T>(std::complex<T>(0, 1), std::complex<T>(0.5, 0.3)); in test_complex() 67 test_plus<T>(std::complex<T>(0, 1), T(0.5)); in test_complex() 68 test_plus<T>(T(0.5), std::complex<T>(0, 1)); in test_complex() 70 test_minus<T>(std::complex<T>(0, 1), std::complex<T>(0.5, 0.3)); in test_complex() 71 test_minus<T>(std::complex<T>(0, 1), T(0.5)); in test_complex() [all …]
|
/llvm-project/clang/test/SemaCXX/ |
H A D | imaginary-constants.cpp | 22 template<typename T> struct complex {}; struct 23 complex<float> operator""if(unsigned long long); 24 complex<float> operator""if(long double); 26 complex<double> operator"" i(unsigned long long); 27 complex<double> operator"" i(long double); 29 complex<long double> operator"" il(unsigned long long); 30 complex<long double> operator"" il(long double); 35 complex<float> f1 = 2.0if; 36 complex<float> f2 = 2if; 37 complex<double> d1 = 2.0i; [all …]
|
/llvm-project/libcxx/test/std/numerics/complex.number/cmplx.over/ |
H A D | pow.pass.cpp | 40 test(T x, const std::complex<U>& y) in test() 43 static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), ""); in test() 44 assert(std::pow(x, y) == pow(std::complex<V>(x, 0), std::complex<V>(y))); in test() 49 test(const std::complex<T>& x, U y) in test() 52 static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), ""); in test() 53 assert(std::pow(x, y) == pow(std::complex<V>(x), std::complex<V>(y, 0))); in test() 58 test(const std::complex<T>& x, const std::complex<U>& y) in test() 61 static_assert((std::is_same<decltype(std::pow(x, y)), std::complex<V> >::value), ""); in test() 62 assert(std::pow(x, y) == pow(std::complex<V>(x), std::complex<V>(y))); in test() 69 test(T(3), std::complex<U>(4, 5)); in test() [all …]
|
/llvm-project/mlir/lib/Conversion/ComplexToLibm/ |
H A D | ComplexToLibm.cpp | 102 patterns.add<ScalarOpToLibmCall<complex::PowOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 104 patterns.add<ScalarOpToLibmCall<complex::SqrtOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 106 patterns.add<ScalarOpToLibmCall<complex::TanhOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 108 patterns.add<ScalarOpToLibmCall<complex::CosOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 110 patterns.add<ScalarOpToLibmCall<complex::SinOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 112 patterns.add<ScalarOpToLibmCall<complex::ConjOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 114 patterns.add<ScalarOpToLibmCall<complex::LogOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() 116 patterns.add<ScalarOpToLibmCall<complex::AbsOp, FloatTypeResolver>>( in populateComplexToLibmConversionPatterns() 118 patterns.add<ScalarOpToLibmCall<complex::AngleOp, FloatTypeResolver>>( in populateComplexToLibmConversionPatterns() 120 patterns.add<ScalarOpToLibmCall<complex::TanOp>>(patterns.getContext(), in populateComplexToLibmConversionPatterns() [all …]
|