================
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir \
+// RUN:   -fno-clangir-call-conv-lowering -menable-no-infs -menable-no-nans \
+// RUN:   -emit-cir %s -o %t-before.cir
+// RUN: FileCheck --check-prefix=BEFORE --input-file=%t-before.cir %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -menable-no-infs 
\
+// RUN:   -menable-no-nans -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s \
+// RUN:   --implicit-check-not=llvm.nofpclass
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -menable-no-infs 
\
+// RUN:   -menable-no-nans -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -menable-no-infs \
+// RUN:   -menable-no-nans -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
+
+// A return with a floating representation gets llvm.nofpclass under
+// -menable-no-infs or -menable-no-nans, and a _Complex __float128 is returned
+// indirectly, so the attribute describes a result the sret rewrite removes.
+// The BEFORE lines pin that the attribute is there to remove, so the CIR
+// checks cannot pass by it never having been attached.
+_Complex __float128 ret_cf128(void) { return 1.0Q; }
+
+// BEFORE: cir.func{{.*}} @ret_cf128() -> (!cir.complex<!cir.f128> 
{llvm.nofpclass = 519 : i64})
----------------
adams381 wrote:

The entire result is `(!cir.complex<!cir.f128> {llvm.nofpclass = 519 : i64})`.  
The result type is `!cir.complex<!cir.f128>`, and its one attribute is 
`{llvm.nofpclass = 519 : i64}`.

The pretty printer shows it as:

```mlir
cir.func @ret_cf128() -> (!cir.complex<!cir.f128> {llvm.nofpclass = 519 : i64})
```

In the generic form (`--mlir-print-op-generic`) you can see that the result 
attributes are a dictionary, and that there is only one entry:

```mlir
function_type = !cir.func<() -> !cir.complex<!cir.f128>>
res_attrs = [{llvm.nofpclass = 519 : i64}]
```

https://github.com/llvm/llvm-project/pull/222465
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to