1@ RUN: not llvm-mc -triple=arm -show-encoding < %s 2>&1 | FileCheck %s 2@ RUN: not llvm-mc -triple=thumb -show-encoding < %s 2>&1 | FileCheck %s --check-prefix=CHECK-THUMB 3 4@ This tests the mnemonic spell checker. 5 6@ First check what happens when an instruction is omitted: 7 8 r1, r2, r3 9 10@ CHECK: error: unexpected token in operand 11@ CHECK-NEXT: r1, r2, r3 12@ CHECK-NEXT: ^ 13 14@ We don't want to see a suggestion here; the edit distance is too large to 15@ give sensible suggestions: 16 17 aaaaaaaaaaaaaaa r1, r2, r3 18 19@ CHECK: error: invalid instruction 20@ CHECK-NEXT: aaaaaaaaaaaaaaa r1, r2, r3 21@ CHECK-NEXT: ^ 22 23@ Check that we get one suggestion: 'pushh' is 1 edit away, i.e. an deletion. 24 25 pushh r1, r2, r3 26 27@CHECK: error: invalid instruction, did you mean: push? 28@CHECK-NEXT: pushh r1, r2, r3 29@CHECK-NEXT: ^ 30 31 adXd r1, r2, r3 32 33@ Check edit distance 1 and 2: 'add' has edit distance of 1 (a deletion), 34@ and 'qadd' a distance of 2 (a deletion and an insertion) 35 36@ CHECK: error: invalid instruction, did you mean: add, qadd? 37@ CHECK-NEXT: adXd r1, r2, r3 38@ CHECK-NEXT: ^ 39 40@ Check edit distance 1 and 2, just insertions: 41 42 ad r1, r2, r3 43 44@ CHECK: error: invalid instruction, did you mean: adc, add, adr, and, qadd? 45@ CHECK-NEXT: ad r1, r2, r3 46@ CHECK-NEXT: ^ 47 48@ Check an instruction that is 2 edits away, and also has a lot of candidates: 49 50 ldre r1, r2, r3 51 52@ CHECK: error: invalid instruction, did you mean: ldr, ldrb, ldrd, ldrex, ldrexb, ldrexd, ldrexh, ldrh, ldrt? 53@ CHECK-NEXT: ldre r1, r2, r3 54@ CHECK-NEXT: ^ 55 56@ Here it is checked that we don't suggest instructions that are not supported. 57@ For example, in Thumb mode we don't want to see suggestions 'faddd' of 'qadd' 58@ because they are not supported. 59 60 fadd r1, r2, r3 61 62@ CHECK-THUMB: error: invalid instruction, did you mean: add? 63@ CHECK-THUMB: fadd r1, r2, r3 64@ CHECK-THUMB: ^ 65 66@ CHECK: error: invalid instruction, did you mean: add, qadd? 67@ CHECK-NEXT: fadd r1, r2, r3 68@ CHECK-NEXT: ^ 69