Skip to content

Commit 6780ab3

Browse files
authored
[Hexagon] Add support for addrspacecast lowering (#119195)
This patch adds support for addrspacecast lowering. At the moment, there are no separate address spaces for Hexagon target, hence this instruction is treated as a noop.
1 parent 7739380 commit 6780ab3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/Target/Hexagon/HexagonTargetMachine.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class HexagonTargetMachine : public CodeGenTargetMachineImpl {
4646
MachineFunctionInfo *
4747
createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
4848
const TargetSubtargetInfo *STI) const override;
49+
50+
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
51+
return true;
52+
}
4953
};
5054

5155
} // end namespace llvm
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; Tests if addrspacecast is handled in Hexagon backend
2+
3+
; REQUIRES: asserts
4+
5+
; RUN: llc -march=hexagon %s -o /dev/null
6+
7+
define double @f(ptr %G, ptr %x) {
8+
BB:
9+
%Castaddrspacecast = addrspacecast ptr %x to ptr addrspace(1)
10+
store ptr addrspace(1) %Castaddrspacecast, ptr %G, align 8
11+
ret double 0.000000e+00
12+
}

0 commit comments

Comments
 (0)