Issue 166501
Summary [AMDGPU] GlobalISel fails to select G_TRUNC
Labels new issue
Assignees
Reporter chinmaydd
    Godbolt: https://godbolt.org/z/jEdY3aGWo

IR:
```
declare i16 @external_i16_func_void()

; GCN-LABEL: {{^}}test_call_external_i16_func_void:
define amdgpu_kernel void @test_call_external_i16_func_void() #0 {
  %val = call i16 @external_i16_func_void()
  store volatile i16 %val, ptr addrspace(1) poison
  ret void
}
```

Command:
```
$ llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1100 -mattr=-flat-for-global 
```

Error:
```
Select:  %13:vgpr_32(s16) = G_TRUNC %26:vgpr(s32)
Failed to constrain G_TRUNC
Selection failed!
Created no instructions.
LLVM ERROR: cannot select: %13:vgpr_32(s16) = G_TRUNC %26:vgpr_32(s32) (in function: test_call_external_i16_func_void)
Compiler returned: 1
```

The IR is valid and works for `global-isel=0` and `global-isel=1` but without the `-mattr=-flat-for-global` restriction. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to