xref: /llvm-project/llvm/test/CodeGen/Hexagon/ps_call_nr.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; RUN: llc -mtriple=hexagon < %s | FileCheck %s
2
3; Test that the compiler does not generate an invalid packet with three
4; instructions that each requires slot 2 or 3. The specification for
5; PS_call_nr was incorrect, which allowed that instrution to go in any slot.
6
7; CHECK: extractu
8; CHECK: extractu
9; CHECK: {
10; CHECK: call
11
12%s.0 = type <{ ptr, ptr, i16, i8, i8, i8 }>
13
14@g0 = external constant %s.0, section ".rodata.trace", align 1
15
16define void @f0() local_unnamed_addr {
17b0:
18  %v0 = load i32, ptr undef, align 4
19  %v1 = trunc i32 %v0 to i2
20  switch i2 %v1, label %b4 [
21    i2 1, label %b1
22    i2 -1, label %b2
23    i2 -2, label %b2
24    i2 0, label %b3
25  ]
26
27b1:                                               ; preds = %b0
28  unreachable
29
30b2:                                               ; preds = %b0, %b0
31  %v2 = load i32, ptr undef, align 4
32  %v3 = lshr i32 %v2, 14
33  %v4 = and i32 %v3, 2047
34  %v5 = lshr i32 %v2, 3
35  %v6 = and i32 %v5, 2047
36  tail call void @f1(ptr nonnull @g0, i32 %v6, i32 %v4, i32 0, i32 0)
37  unreachable
38
39b3:                                               ; preds = %b0
40  ret void
41
42b4:                                               ; preds = %b0
43  unreachable
44}
45
46declare void @f1(ptr, i32, i32, i32, i32) local_unnamed_addr
47