1# RUN: not llvm-mc -triple mips-unknown-linux-gnu -mcpu=mips32r2 \
2# RUN:             -mattr=+micromips %s 2>&1 \
3# RUN:   | FileCheck --check-prefixes=ALL,MMR2 %s
4# RUN: not llvm-mc -triple mips-unknown-linux-gnu -mcpu=mips32r6 \
5# RUN:             -mattr=+micromips %s 2>&1 \
6# RUN:   | FileCheck --check-prefixes=ALL,MMR6 %s
7# RUN: not llvm-mc -triple mips-unknown-linux-gnu -mcpu=mips32r6 %s 2>&1 \
8# RUN:   | FileCheck --check-prefixes=ALL,MIPS32R6 %s
9
10# This tests the mnemonic spell checker.
11
12# First check what happens when an instruction is omitted:
13
14$2, $1, $25
15
16# ALL:      error: unknown instruction
17# ALL-NEXT: $2, $1, $25
18# ALL-NEXT:  ^
19
20# We don't want to see a suggestion here; the edit distance is too large to
21# give sensible suggestions:
22
23aaaaaaaaaaaaaaa $2, $1, $25
24
25# ALL:      error: unknown instruction
26# ALL-NEXT: aaaaaaaaaaaaaaa $2, $1, $25
27# ALL-NEXT: ^
28
29# Check that we get one suggestion: 'addiuspi' is 1 edit away, i.e. an deletion.
30
31addiuspi -16
32
33# MMR2:     error: unknown instruction, did you mean: addiusp?
34# MMR6:     error: unknown instruction, did you mean: addiusp?
35# MIPS32R6: error: unknown instruction{{$}}
36# ALL:      addiuspi -16
37# ALL-NEXT: ^
38
39# Check edit distance 1 and 2, just insertions:
40
41addru $9, $6, 17767
42
43# MMR2:      error: unknown instruction, did you mean: add, addiu, addu, maddu?
44# MMR6:      error: unknown instruction, did you mean: add, addiu, addu?
45# MIPS32R6:  error: unknown instruction, did you mean: add, addiu, addu?
46# ALL:       addru $9, $6, 17767
47# ALL-NEXT:  ^
48
49# Check an instruction that is 2 edits away, and also has a lot of candidates:
50
51culE.d  $fcc7, $f24, $f18
52
53# MMR2:     error: unknown instruction, did you mean: c.le.d, c.ule.d?
54# MMR6:     error: unknown instruction{{$}}
55# MIPS32R6: error: unknown instruction{{$}}
56# ALL:      culE.d  $fcc7, $f24, $f18
57# ALL-NEXT: ^
58
59# Check that candidates list includes only instructions valid for target CPU.
60
61swk $3, $4
62
63# MMR2: error: unknown instruction, did you mean: sw, swl, swm, swp, swr, usw?
64# MMR6: error: unknown instruction, did you mean: sw, swm, swp, usw?
65# MIPS32R6: error: unknown instruction, did you mean: sw, usw?
66# ALL:      swk $3, $4
67# ALL-NEXT: ^
68