xref: /aosp_15_r20/external/llvm/test/MC/Hexagon/new-value-check.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: not llvm-mc -triple=hexagon < %s 2>&1 | \
2*9880d681SAndroid Build Coastguard Worker# RUN:     FileCheck %s --check-prefix=CHECK-STRICT
3*9880d681SAndroid Build Coastguard Worker# RUN: not llvm-mc -triple=hexagon -relax-nv-checks < %s 2>&1 | \
4*9880d681SAndroid Build Coastguard Worker# RUN:     FileCheck %s --check-prefix=CHECK-RELAXED
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker# CHECK-STRICT: :12:1: error: register `R0' used with `.new' but not validly modified in the same packet
7*9880d681SAndroid Build Coastguard Worker# CHECK-RELAXED: :12:1: error: register `R0' used with `.new' but not validly modified in the same packet
8*9880d681SAndroid Build Coastguard Worker{
9*9880d681SAndroid Build Coastguard Worker  # invalid: r0 definition predicated on the opposite condition
10*9880d681SAndroid Build Coastguard Worker  if (p3) r0 = add(r1, r2)
11*9880d681SAndroid Build Coastguard Worker  if (!p3) memb(r20) = r0.new
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker# CHECK-STRICT: :20:1: error: register `R0' used with `.new' but not validly modified in the same packet
15*9880d681SAndroid Build Coastguard Worker# CHECK-RELAXED: :20:1: error: register `R0' used with `.new' but not validly modified in the same packet
16*9880d681SAndroid Build Coastguard Worker{
17*9880d681SAndroid Build Coastguard Worker  # invalid: new-value compare-and-jump cannot use floating point value
18*9880d681SAndroid Build Coastguard Worker  r0 = sfadd(r1, r2)
19*9880d681SAndroid Build Coastguard Worker  if (cmp.eq(r0.new, #0)) jump:nt .
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker# CHECK-STRICT: :29:1: error: register `R0' used with `.new' but not validly modified in the same packet
23*9880d681SAndroid Build Coastguard Worker# CHECK-RELAXED: :29:1: error: register `R0' used with `.new' but not validly modified in the same packet
24*9880d681SAndroid Build Coastguard Worker{
25*9880d681SAndroid Build Coastguard Worker  # invalid: definition of r0 should be unconditional (not explicitly docu-
26*9880d681SAndroid Build Coastguard Worker  # mented)
27*9880d681SAndroid Build Coastguard Worker  if (p0) r0 = r1
28*9880d681SAndroid Build Coastguard Worker  if (cmp.eq(r0.new, #0)) jump:nt .
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker# No errors from this point on with the relaxed checks.
33*9880d681SAndroid Build Coastguard Worker# CHECK-RELAXED-NOT: error
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker# CHECK-STRICT: :41:1: error: register `R0' used with `.new' but not validly modified in the same packet
36*9880d681SAndroid Build Coastguard Worker{
37*9880d681SAndroid Build Coastguard Worker  # valid (relaxed): p2 and p3 cannot be proven to violate the new-value
38*9880d681SAndroid Build Coastguard Worker  # requirements
39*9880d681SAndroid Build Coastguard Worker  if (p3) r0 = add(r1, r2)
40*9880d681SAndroid Build Coastguard Worker  if (p2) memb(r20) = r0.new
41*9880d681SAndroid Build Coastguard Worker}
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker# CHECK-STRICT: :48:1: error: register `R0' used with `.new' but not validly modified in the same packet
44*9880d681SAndroid Build Coastguard Worker{
45*9880d681SAndroid Build Coastguard Worker  # valid (relaxed): p3 could be always true
46*9880d681SAndroid Build Coastguard Worker  if (p3) r0 = add(r1, r2)
47*9880d681SAndroid Build Coastguard Worker  memb(r20) = r0.new
48*9880d681SAndroid Build Coastguard Worker}
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker# No errors from this point on with the strict checks.
52*9880d681SAndroid Build Coastguard Worker# CHECK-RELAXED-NOT: error
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Worker{
55*9880d681SAndroid Build Coastguard Worker  # valid: r0 defined unconditionally
56*9880d681SAndroid Build Coastguard Worker  r0 = add(r1, r2)
57*9880d681SAndroid Build Coastguard Worker  if (p2) memb(r20) = r0.new
58*9880d681SAndroid Build Coastguard Worker}
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Worker{
61*9880d681SAndroid Build Coastguard Worker  # valid: r0 definition and use identically predicated
62*9880d681SAndroid Build Coastguard Worker  if (p3) r0 = add(r1, r2)
63*9880d681SAndroid Build Coastguard Worker  if (p3) memb(r20) = r0.new
64*9880d681SAndroid Build Coastguard Worker}
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Worker{
67*9880d681SAndroid Build Coastguard Worker  # valid: r0 defined regardless of p0
68*9880d681SAndroid Build Coastguard Worker  if (p0) r0 = #0
69*9880d681SAndroid Build Coastguard Worker  if (!p0) r0 = #1
70*9880d681SAndroid Build Coastguard Worker  if (p0) memb(r20) = r0.new
71*9880d681SAndroid Build Coastguard Worker}
72*9880d681SAndroid Build Coastguard Worker
73