// RUN: mlir-opt %s --irdl-file=%S/cmath.irdl.mlir | mlir-opt --irdl-file=%S/cmath.irdl.mlir | FileCheck %s module { // CHECK: func.func @conorm(%[[p:[^:]*]]: !cmath.complex, %[[q:[^:]*]]: !cmath.complex) -> f32 { // CHECK: %[[norm_p:[^ ]*]] = "cmath.norm"(%[[p]]) : (!cmath.complex) -> f32 // CHECK: %[[norm_q:[^ ]*]] = "cmath.norm"(%[[q]]) : (!cmath.complex) -> f32 // CHECK: %[[pq:[^ ]*]] = arith.mulf %[[norm_p]], %[[norm_q]] : f32 // CHECK: return %[[pq]] : f32 // CHECK: } func.func @conorm(%p: !cmath.complex, %q: !cmath.complex) -> f32 { %norm_p = "cmath.norm"(%p) : (!cmath.complex) -> f32 %norm_q = "cmath.norm"(%q) : (!cmath.complex) -> f32 %pq = arith.mulf %norm_p, %norm_q : f32 return %pq : f32 } // CHECK: func.func @conorm2(%[[p:[^:]*]]: !cmath.complex, %[[q:[^:]*]]: !cmath.complex) -> f32 { // CHECK: %[[pq:[^ ]*]] = "cmath.mul"(%[[p]], %[[q]]) : (!cmath.complex, !cmath.complex) -> !cmath.complex // CHECK: %[[conorm:[^ ]*]] = "cmath.norm"(%[[pq]]) : (!cmath.complex) -> f32 // CHECK: return %[[conorm]] : f32 // CHECK: } func.func @conorm2(%p: !cmath.complex, %q: !cmath.complex) -> f32 { %pq = "cmath.mul"(%p, %q) : (!cmath.complex, !cmath.complex) -> !cmath.complex %conorm = "cmath.norm"(%pq) : (!cmath.complex) -> f32 return %conorm : f32 } }