Files
clang-p2996/llvm/test/CodeGen/Hexagon/packetizer-resources.ll
James Molloy b6c7fce67a [DFAPacketizer] Reapply: Track resources for packetized instructions
Reapply with fix to reduce resources required by the compiler - use
unsigned[2] instead of std::pair. This causes clang and gcc to compile
the generated file multiple times faster, and hopefully will reduce
the resource requirements on Visual Studio also. This fix is a little
ugly but it's clearly the same issue the previous author of
DFAPacketizer faced (the previous tables use unsigned[2] rather uglily
too).

This patch allows the DFAPacketizer to be queried after a packet is formed to work out which
resources were allocated to the packetized instructions.

This is particularly important for targets that do their own bundle packing - it's not
sufficient to know simply that instructions can share a packet; which slots are used is
also required for encoding.

This extends the emitter to emit a side-table containing resource usage diffs for each
state transition. The packetizer maintains a set of all possible resource states in its
current state. After packetization is complete, all remaining resource states are
possible packetization strategies.

The sidetable is only ~500K for Hexagon, but the extra tracking is disabled by default
(most uses of the packetizer like MachinePipeliner don't care and don't need the extra
maintained state).

Differential Revision: https://reviews.llvm.org/D66936

llvm-svn: 371399
2019-09-09 13:17:55 +00:00

30 lines
837 B
LLVM

; RUN: llc -O2 -march=hexagon < %s -debug-only=packets 2>&1 | FileCheck %s
; REQUIRES: asserts
; CHECK: Finalizing packet:
; CHECK-NEXT: * [res:0x8] renamable $r1 = S2_vsplatrb renamable $r0
; CHECK-NEXT: * [res:0x4] renamable $d1 = S2_vsplatrh killed renamable $r0
target triple = "hexagon"
; Function Attrs: nounwind readnone
define i64 @f0(i64 %a0) #0 {
b0:
%v0 = trunc i64 %a0 to i32
%v1 = and i32 %v0, 65535
%v2 = tail call i64 @llvm.hexagon.S2.vsplatrh(i32 %v1)
%v3 = and i32 %v0, 255
%v4 = tail call i32 @llvm.hexagon.S2.vsplatrb(i32 %v3)
%v5 = sext i32 %v4 to i64
%v6 = add nsw i64 %v5, %v2
ret i64 %v6
}
; Function Attrs: nounwind readnone
declare i64 @llvm.hexagon.S2.vsplatrh(i32) #0
; Function Attrs: nounwind readnone
declare i32 @llvm.hexagon.S2.vsplatrb(i32) #0
attributes #0 = { nounwind readnone }