<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/154337>154337</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
NVPTX assembly emited by LLVM NVPTX assembly failed to compile due to `u2` type in global
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aikawayataro
</td>
</tr>
</table>
<pre>
Example LLVM IR:
```
source_filename = "test"
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda11.0.1-unknown"
@"test_global" = internal unnamed_addr addrspace(1) constant i2 1, align 1
attributes #0 = { noredzone nounwind "frame-pointer"="all" "target-cpu"="sm_80" "target-features"="+ptx70,+sm_80,-ptx32,-ptx40,-ptx41,-ptx42,-ptx43,-ptx50,-ptx60,-ptx61,-ptx62,-ptx63,-ptx64,-ptx65,-ptx71,-ptx72,-ptx73,-ptx74,-ptx75,-ptx76,-ptx77,-ptx78,-ptx80,-ptx81,-ptx82,-ptx83,-ptx84,-ptx85,-ptx86,-ptx87,-sm_100,-sm_100a,-sm_101,-sm_101a,-sm_120,-sm_120a,-sm_20,-sm_21,-sm_30,-sm_32,-sm_35,-sm_37,-sm_50,-sm_52,-sm_53,-sm_60,-sm_61,-sm_62,-sm_70,-sm_72,-sm_75,-sm_86,-sm_87,-sm_89,-sm_90,-sm_90a" }
!llvm.module.flags = !{}
```
Used to generate assembly with `llc -march=nvptx64 -mcpu=sm_80 bug.ll` emits the following NVPTX assembly:
```
//
// Generated by LLVM NVPTX Back-End
//
.version 7.0
.target sm_80
.address_size 64
.global .align 1 .u2 test_global = 1;
```
`ptxas` fails to assembly it:
```shell
$ ptxas --gpu-name=sm_80 bug.s -o bug.cubin
ptxas bug.s, line 9; fatal : Parsing error near '.u2': syntax error
ptxas fatal : Ptx assembly aborted due to errors
```
</pre>
<img width="1" height="1" al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