1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -mattr=+msa | \
2# RUN:   FileCheck %s
3# .set push creates a copy of the current environment.
4# .set pop restores the previous environment.
5# FIXME: Also test resetting of .set macro/nomacro option.
6
7    .text
8    # The first environment on the stack (with initial values).
9    lw       $1, 65536($1)
10    b        1336
11    addvi.b  $w15, $w13, 18
12
13    # Create a new environment.
14    .set push
15    .set at=$ra           # Test the ATReg option.
16    lw       $1, 65536($1)
17    .set noreorder        # Test the Reorder option.
18    b        1336
19    .set nomsa            # Test the Features option (ASE).
20    .set mips32r6         # Test the Features option (ISA).
21    mod      $2, $4, $6
22
23    # Switch back to the first environment.
24    .set pop
25    lw       $1, 65536($1)
26    b        1336
27    addvi.b  $w15, $w13, 18
28
29# CHECK:  lui      $1, 1
30# CHECK:  addu     $1, $1, $1
31# CHECK:  lw       $1, 0($1)
32# CHECK:  b        1336
33# CHECK:  nop
34# CHECK:  addvi.b  $w15, $w13, 18
35
36# CHECK:  .set push
37# CHECK:  lui      $ra, 1
38# CHECK:  addu     $ra, $ra, $1
39# CHECK:  lw       $1, 0($ra)
40# CHECK:  .set noreorder
41# CHECK:  b        1336
42# CHECK-NOT:  nop
43# CHECK:  .set nomsa
44# CHECK:  .set mips32r6
45# CHECK:  mod      $2, $4, $6
46
47# CHECK:  .set pop
48# CHECK:  lui      $1, 1
49# CHECK:  addu     $1, $1, $1
50# CHECK:  lw       $1, 0($1)
51# CHECK:  b        1336
52# CHECK:  nop
53# CHECK:  addvi.b  $w15, $w13, 18
54
55    .set push
56    .set dsp
57    lbux    $7, $10($11)
58    .set pop
59
60    .set push
61    .set dsp
62    lbux    $7, $10($11)
63# CHECK-NOT: :[[@LINE-1]]:5: error: instruction requires a CPU feature not currently enabled
64    .set pop
65
66    .set push
67    .set dsp
68    lbux    $7, $10($11)
69# CHECK-NOT: :[[@LINE-1]]:5: error: instruction requires a CPU feature not currently enabled
70    .set pop
71