[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-19 Thread Kamau Bridgeman via cfe-commits

https://github.com/kamaub created 
https://github.com/llvm/llvm-project/pull/96109

'a' is an input/ouput constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.


>From 87983d169582bc5156220594e0fc4812f424bf75 Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Wed, 19 Jun 2024 14:59:53 -0500
Subject: [PATCH] [PPC][InlineASM] Mark the 'a' constraint as unsupported

'a' is an input/ouput constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.
---
 clang/lib/Basic/Targets/PPC.h | 4 +++-
 .../PowerPC/inline-asm-unsupported-constraint-error.c | 8 
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 
clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c

diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index fc23c30c68523..e4d6a02386da5 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -305,9 +305,11 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   // asm statements)
   Info.setAllowsMemory();
   break;
-case 'R': // AIX TOC entry
 case 'a': // Address operand that is an indexed or indirect from a
   // register (`p' is preferable for asm statements)
+  // TODO: Add full support for this constraint
+  return false;
+case 'R': // AIX TOC entry
 case 'S': // Constant suitable as a 64-bit mask operand
 case 'T': // Constant suitable as a 32-bit mask operand
 case 'U': // System V Release 4 small data area reference
diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
new file mode 100644
index 0..457908f016b0c
--- /dev/null
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// This test case exist to test marking the 'a' inline assembly constraint as
+// unsupported because powerpc previously marked it as supported.
+int foo(int arg){
+  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  return 0;
+TEST_LABEL: return arg + 1;
+}

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-19 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Kamau Bridgeman (kamaub)


Changes

'a' is an input/ouput constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.


---
Full diff: https://github.com/llvm/llvm-project/pull/96109.diff


2 Files Affected:

- (modified) clang/lib/Basic/Targets/PPC.h (+3-1) 
- (added) clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
(+8) 


``diff
diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index fc23c30c68523..e4d6a02386da5 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -305,9 +305,11 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   // asm statements)
   Info.setAllowsMemory();
   break;
-case 'R': // AIX TOC entry
 case 'a': // Address operand that is an indexed or indirect from a
   // register (`p' is preferable for asm statements)
+  // TODO: Add full support for this constraint
+  return false;
+case 'R': // AIX TOC entry
 case 'S': // Constant suitable as a 64-bit mask operand
 case 'T': // Constant suitable as a 32-bit mask operand
 case 'U': // System V Release 4 small data area reference
diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
new file mode 100644
index 0..457908f016b0c
--- /dev/null
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// This test case exist to test marking the 'a' inline assembly constraint as
+// unsupported because powerpc previously marked it as supported.
+int foo(int arg){
+  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  return 0;
+TEST_LABEL: return arg + 1;
+}

``




https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-19 Thread Chen Zheng via cfe-commits

https://github.com/chenzheng1030 edited 
https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-19 Thread Chen Zheng via cfe-commits


@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s

chenzheng1030 wrote:

nit: can you also add run lines for AIX 32 and 64 bit?

https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-19 Thread Chen Zheng via cfe-commits

https://github.com/chenzheng1030 approved this pull request.

LGTM except a nit.

https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-21 Thread Kamau Bridgeman via cfe-commits

https://github.com/kamaub updated 
https://github.com/llvm/llvm-project/pull/96109

>From 87983d169582bc5156220594e0fc4812f424bf75 Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Wed, 19 Jun 2024 14:59:53 -0500
Subject: [PATCH 1/2] [PPC][InlineASM] Mark the 'a' constraint as unsupported

'a' is an input/ouput constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.
---
 clang/lib/Basic/Targets/PPC.h | 4 +++-
 .../PowerPC/inline-asm-unsupported-constraint-error.c | 8 
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 
clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c

diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index fc23c30c68523..e4d6a02386da5 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -305,9 +305,11 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   // asm statements)
   Info.setAllowsMemory();
   break;
-case 'R': // AIX TOC entry
 case 'a': // Address operand that is an indexed or indirect from a
   // register (`p' is preferable for asm statements)
+  // TODO: Add full support for this constraint
+  return false;
+case 'R': // AIX TOC entry
 case 'S': // Constant suitable as a 64-bit mask operand
 case 'T': // Constant suitable as a 32-bit mask operand
 case 'U': // System V Release 4 small data area reference
diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
new file mode 100644
index 0..457908f016b0c
--- /dev/null
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// This test case exist to test marking the 'a' inline assembly constraint as
+// unsupported because powerpc previously marked it as supported.
+int foo(int arg){
+  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  return 0;
+TEST_LABEL: return arg + 1;
+}

>From 6c3ff4ab36bb565d53dc6bac2577fd0f8c033f6b Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Fri, 21 Jun 2024 13:02:50 -0500
Subject: [PATCH 2/2] Addressing review comment

Adding test case run lines for aix 32 and 64 bit targets.
---
 .../PowerPC/inline-asm-unsupported-constraint-error.c   | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
index 457908f016b0c..ebabc1d90b051 100644
--- a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -1,8 +1,10 @@
-// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64-ibm-aix-xcoff -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc-ibm-aix-xcoff -verify %s
 // This test case exist to test marking the 'a' inline assembly constraint as
 // unsupported because powerpc previously marked it as supported.
 int foo(int arg){
-  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  asm goto ("bc 12,2,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
   return 0;
 TEST_LABEL: return arg + 1;
 }

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-21 Thread Fangrui Song via cfe-commits


@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-linux-gnu -verify %s

MaskRay wrote:

I think one RUN line (powerpc64) is sufficient. Duplicating this for ELF/XCOFF 
isn't necessary.

`inline-asm-constraints-error.c` might be a better test name. You can reuse the 
test for other errors.

https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-21 Thread Fangrui Song via cfe-commits

https://github.com/MaskRay approved this pull request.


https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-24 Thread Kamau Bridgeman via cfe-commits

https://github.com/kamaub updated 
https://github.com/llvm/llvm-project/pull/96109

>From 87983d169582bc5156220594e0fc4812f424bf75 Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Wed, 19 Jun 2024 14:59:53 -0500
Subject: [PATCH 1/3] [PPC][InlineASM] Mark the 'a' constraint as unsupported

'a' is an input/ouput constraint for restraining assembly variables
to an indexed or indirect address operand. It previously was marked
as supported but would throw an assertion for unknown constraint type
in the back-end when this test case was compiled. This change marks it
as unsupported until we can add full support for address operands
constraining to the compiler code generation.
---
 clang/lib/Basic/Targets/PPC.h | 4 +++-
 .../PowerPC/inline-asm-unsupported-constraint-error.c | 8 
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 
clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c

diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index fc23c30c68523..e4d6a02386da5 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -305,9 +305,11 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   // asm statements)
   Info.setAllowsMemory();
   break;
-case 'R': // AIX TOC entry
 case 'a': // Address operand that is an indexed or indirect from a
   // register (`p' is preferable for asm statements)
+  // TODO: Add full support for this constraint
+  return false;
+case 'R': // AIX TOC entry
 case 'S': // Constant suitable as a 64-bit mask operand
 case 'T': // Constant suitable as a 32-bit mask operand
 case 'U': // System V Release 4 small data area reference
diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
new file mode 100644
index 0..457908f016b0c
--- /dev/null
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// This test case exist to test marking the 'a' inline assembly constraint as
+// unsupported because powerpc previously marked it as supported.
+int foo(int arg){
+  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  return 0;
+TEST_LABEL: return arg + 1;
+}

>From 6c3ff4ab36bb565d53dc6bac2577fd0f8c033f6b Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Fri, 21 Jun 2024 13:02:50 -0500
Subject: [PATCH 2/3] Addressing review comment

Adding test case run lines for aix 32 and 64 bit targets.
---
 .../PowerPC/inline-asm-unsupported-constraint-error.c   | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
index 457908f016b0c..ebabc1d90b051 100644
--- a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
+++ b/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
@@ -1,8 +1,10 @@
-// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-unknown-unknown -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64le-linux-gnu -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc64-ibm-aix-xcoff -verify %s
+// RUN: %clang_cc1 -emit-llvm -triple powerpc-ibm-aix-xcoff -verify %s
 // This test case exist to test marking the 'a' inline assembly constraint as
 // unsupported because powerpc previously marked it as supported.
 int foo(int arg){
-  asm goto ("bc %0,%1,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
+  asm goto ("bc 12,2,%l[TEST_LABEL]" : : "a"(&&TEST_LABEL) : : TEST_LABEL); 
//expected-error {{invalid input constraint 'a' in asm}}
   return 0;
 TEST_LABEL: return arg + 1;
 }

>From d36eb3e75f3adbc9414b314a6decf12f3adbd8c0 Mon Sep 17 00:00:00 2001
From: Kamau Bridgeman 
Date: Mon, 24 Jun 2024 07:32:06 -0500
Subject: [PATCH 3/3] Addressing review comments.

---
 ...pported-constraint-error.c => inline-asm-constraints-error.c} | 1 -
 1 file changed, 1 deletion(-)
 rename clang/test/CodeGen/PowerPC/{inline-asm-unsupported-constraint-error.c 
=> inline-asm-constraints-error.c} (87%)

diff --git 
a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c 
b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c
similarity index 87%
rename from clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
rename to clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c
index ebabc1d90b051..eb443eee40e55 100644
--- a/clang/test/CodeGen/PowerPC/inline-asm-unsupported-constraint-error.c
+++ b/clang/test/CodeGen/PowerPC/inline-asm-constraints-error.c
@@ -1,4 +1,3 @@
-// RUN: %clang_cc1 -emit-llvm -tr

[clang] [PPC][InlineASM] Mark the 'a' constraint as unsupported (PR #96109)

2024-06-24 Thread Kamau Bridgeman via cfe-commits

https://github.com/kamaub closed https://github.com/llvm/llvm-project/pull/96109
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits