diff options
author | Fangrui Song <i@maskray.me> | 2023-12-17 19:04:51 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2023-12-17 19:04:51 -0800 |
commit | d5e16e36d5695812bee8bd3e0d4c2904787bf0c0 (patch) | |
tree | 4b08c311aa033adafe657af35ea697a131ad2fe0 /llvm/test/MC/X86/displacement-overflow.s | |
parent | 6655581038f8479f0f6942b7d34cbd6556d00a0e (diff) | |
download | llvm-users/MaskRay/spr/main.improve-warning.zip llvm-users/MaskRay/spr/main.improve-warning.tar.gz llvm-users/MaskRay/spr/main.improve-warning.tar.bz2 |
[𝘀𝗽𝗿] changes to main this commit is based onusers/MaskRay/spr/main.improve-warning
Created using spr 1.3.4
[skip ci]
Diffstat (limited to 'llvm/test/MC/X86/displacement-overflow.s')
-rw-r--r-- | llvm/test/MC/X86/displacement-overflow.s | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/MC/X86/displacement-overflow.s b/llvm/test/MC/X86/displacement-overflow.s new file mode 100644 index 0000000..626003a --- /dev/null +++ b/llvm/test/MC/X86/displacement-overflow.s @@ -0,0 +1,36 @@ +# RUN: not llvm-mc -triple=x86_64 %s 2>&1 | FileCheck %s --check-prefixes=CHECK,64 --implicit-check-not=error: --implicit-check-not=warning: +# RUN: llvm-mc -triple=i686 --defsym A16=1 %s 2>&1 | FileCheck %s --check-prefixes=CHECK,32 --implicit-check-not=error: --implicit-check-not=warning: + +.ifndef A16 +movq 0x80000000-1(%rip), %rax +leaq -0x80000000(%rip), %rax + +# 64: [[#@LINE+1]]:17: error: displacement 2147483648 is not within [-2147483648, 2147483647] +movq 0x80000000(%rip), %rax + +# 64: [[#@LINE+1]]:18: error: displacement -2147483649 is not within [-2147483648, 2147483647] +leaq -0x80000001(%rip), %rax +.endif + +movl 0xffffffff(%eax), %eax +leal -0xffffffff(%eax), %eax + +# CHECK: [[#@LINE+1]]:19: warning: displacement 4294967296 shortened to signed 32-bit +movl 0xffffffff+1(%eax), %eax + +# CHECK: [[#@LINE+1]]:20: warning: displacement -4294967296 shortened to signed 32-bit +leal -0xffffffff-1(%eax), %eax + +{disp8} leal 0x100(%ebx), %eax +{disp8} leal -0x100(%ebx), %eax + +.ifdef A16 +.code16 +movw $0, 0xffff(%bp) +movw $0, -0xffff(%si) + +# 32: [[#@LINE+1]]:19: warning: displacement 65536 shortened to signed 16-bit +movw $0, 0xffff+1(%bp) +# 32: [[#@LINE+1]]:20: warning: displacement -65536 shortened to signed 16-bit +movw $0, -0xffff-1(%si) +.endif |