1# RUN: not llvm-mc -triple=hexagon < %s 2>&1 | \
2# RUN:     FileCheck %s --check-prefix=CHECK-STRICT
3# RUN: not llvm-mc -triple=hexagon -relax-nv-checks < %s 2>&1 | \
4# RUN:     FileCheck %s --check-prefix=CHECK-RELAXED
5
6# CHECK-STRICT: :10:3: note: Register producer has the opposite predicate sense as consumer
7# CHECK-RELAXED: :10:3: note: Register producer has the opposite predicate sense as consumer
8{
9  # invalid: r0 definition predicated on the opposite condition
10  if (p3) r0 = add(r1, r2)
11  if (!p3) memb(r20) = r0.new
12}
13
14# CHECK-STRICT: :18:3: note: FPU instructions cannot be new-value producers for jumps
15# CHECK-RELAXED: :18:3: note: FPU instructions cannot be new-value producers for jumps
16# CHECK-RELAXED: :19:3: error: Instruction does not have a valid new register producer
17{ # invalid: new-value compare-and-jump cannot use floating point value
18  r0 = sfadd(r1, r2)
19  if (cmp.eq(r0.new, #0)) jump:nt .
20}
21
22# No errors from this point on with the relaxed checks.
23# CHECK-RELAXED-NOT: error
24
25# CHECK-STRICT: :28:3: note: Register producer is predicated and consumer is unconditional
26{
27  # valid in relaxed, p0 could always be true
28  if (p0) r0 = r1
29  if (cmp.eq(r0.new, #0)) jump:nt .
30}
31
32# CHECK-STRICT: :36:3: note: Register producer does not use the same predicate register as the consumer
33{
34  # valid (relaxed): p2 and p3 cannot be proven to violate the new-value
35  # requirements
36  if (p3) r0 = add(r1, r2)
37  if (p2) memb(r20) = r0.new
38}
39
40# CHECK-STRICT: :43:3: note: Register producer is predicated and consumer is unconditional
41{
42  # valid (relaxed): p3 could be always true
43  if (p3) r0 = add(r1, r2)
44  memb(r20) = r0.new
45}
46
47
48# No errors from this point on with the strict checks.
49# CHECK-RELAXED-NOT: error
50
51{
52  # valid: r0 defined unconditionally
53  r0 = add(r1, r2)
54  if (p2) memb(r20) = r0.new
55}
56
57{
58  # valid: r0 definition and use identically predicated
59  if (p3) r0 = add(r1, r2)
60  if (p3) memb(r20) = r0.new
61}
62
63{
64  # valid: r0 defined regardless of p0
65  if (p0) r0 = #0
66  if (!p0) r0 = #1
67  if (p0) memb(r20) = r0.new
68}
69
70