xref: /llvm-project/llvm/test/MC/X86/displacement-overflow.s (revision 8a71284cb9463a90fab0d9e8edbeb5d879531e32)
1*8a71284cSSimon Pilgrim# RUN: not llvm-mc -triple=x86_64 %s 2>&1 | FileCheck %s --check-prefixes=CHECK,X64 --implicit-check-not=error: --implicit-check-not=warning:
2*8a71284cSSimon Pilgrim# RUN: llvm-mc -triple=i686 --defsym A16=1 %s 2>&1 | FileCheck %s --check-prefixes=CHECK,X86 --implicit-check-not=error: --implicit-check-not=warning:
383680f8cSFangrui Song
483680f8cSFangrui Song.ifndef A16
583680f8cSFangrui Songmovq 0x80000000-1(%rip), %rax
683680f8cSFangrui Songleaq -0x80000000(%rip), %rax
783680f8cSFangrui Song
8*8a71284cSSimon Pilgrim# X64: [[#@LINE+1]]:17: error: displacement 2147483648 is not within [-2147483648, 2147483647]
983680f8cSFangrui Songmovq 0x80000000(%rip), %rax
1083680f8cSFangrui Song
11*8a71284cSSimon Pilgrim# X64: [[#@LINE+1]]:18: error: displacement -2147483649 is not within [-2147483648, 2147483647]
1283680f8cSFangrui Songleaq -0x80000001(%rip), %rax
1383680f8cSFangrui Song.endif
1483680f8cSFangrui Song
1583680f8cSFangrui Songmovl 0xffffffff(%eax), %eax
1683680f8cSFangrui Songleal -0xffffffff(%eax), %eax
1783680f8cSFangrui Song
1883680f8cSFangrui Song# CHECK: [[#@LINE+1]]:19: warning: displacement 4294967296 shortened to 32-bit signed 0
1983680f8cSFangrui Songmovl 0xffffffff+1(%eax), %eax
2083680f8cSFangrui Song
2183680f8cSFangrui Song# CHECK: [[#@LINE+1]]:20: warning: displacement -4294967296 shortened to 32-bit signed 0
2283680f8cSFangrui Songleal -0xffffffff-1(%eax), %eax
2383680f8cSFangrui Song# CHECK: [[#@LINE+1]]:20: warning: displacement -4294967297 shortened to 32-bit signed -1
2483680f8cSFangrui Songleal -0xffffffff-2(%eax), %eax
2583680f8cSFangrui Song
2683680f8cSFangrui Song{disp8} leal 0x100(%ebx), %eax
2783680f8cSFangrui Song{disp8} leal -0x100(%ebx), %eax
2883680f8cSFangrui Song
2983680f8cSFangrui Song.ifdef A16
3083680f8cSFangrui Song.code16
3183680f8cSFangrui Songmovw $0, 0xffff(%bp)
3283680f8cSFangrui Songmovw $0, -0xffff(%si)
3383680f8cSFangrui Song
34*8a71284cSSimon Pilgrim# X86: [[#@LINE+1]]:19: warning: displacement 65536 shortened to 16-bit signed 0
3583680f8cSFangrui Songmovw $0, 0xffff+1(%bp)
36*8a71284cSSimon Pilgrim# X86: [[#@LINE+1]]:20: warning: displacement -65536 shortened to 16-bit signed 0
3783680f8cSFangrui Songmovw $0, -0xffff-1(%si)
3883680f8cSFangrui Song.endif
39