[lldb] [test/Register] Attempt to fix x86-fp-read.test on Darwin

Darwin seems to use stmmN instead of stN. Use a regex to accept both.

Also try to actually clear st(7).

Differential revision: https://reviews.llvm.org/D88795
This commit is contained in:
Michał Górny 2020-10-04 23:03:46 -07:00 committed by Jonas Devlieghere
parent b18026114a
commit e8beb6988b
2 changed files with 16 additions and 13 deletions

View File

@ -14,7 +14,8 @@ int main() {
{0x8000000000000000, 0x7fff}, // +inf
{0x8000000000000000, 0xffff}, // -inf
{0xc000000000000000, 0xffff}, // nan
// leave st7 empty to test tag word better
// st7 will be freed to test tag word better
{0x0000000000000000, 0x0000}, // +0
};
// unmask divide-by-zero exception
@ -26,6 +27,7 @@ int main() {
"finit\n\t"
"fldcw %1\n\t"
// load on stack in reverse order to make the result easier to read
"fldt 0x70(%0)\n\t"
"fldt 0x60(%0)\n\t"
"fldt 0x50(%0)\n\t"
"fldt 0x40(%0)\n\t"
@ -33,6 +35,8 @@ int main() {
"fldt 0x20(%0)\n\t"
"fldt 0x10(%0)\n\t"
"fldt 0x00(%0)\n\t"
// free st7
"ffree %%st(7)\n\t"
// this should trigger a divide-by-zero
"fdivs (%2)\n\t"
"int3\n\t"

View File

@ -1,5 +1,4 @@
# XFAIL: system-windows
# XFAIL: system-darwin
# REQUIRES: native && (target-x86 || target-x86_64)
# RUN: %clangxx_host -g %p/Inputs/x86-fp-read.cpp -o %t
# RUN: %lldb -b -s %s %t | FileCheck %s
@ -8,20 +7,20 @@ process launch
register read --all
# CHECK-DAG: fctrl = 0x037b
# CHECK-DAG: fstat = 0x8884
# CHECK-DAG: fstat = 0x8084
# TODO: the following value is incorrect, it's a bug in the way
# FXSAVE/XSAVE is interpreted; it should be 0xa963 once fixed
# CHECK-DAG: ftag = 0x00fe
# FXSAVE/XSAVE is interpreted
# CHECK-DAG: ftag = 0x007f
# CHECK-DAG: fop = 0x0033
# CHECK-DAG: st0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0x00 0x40}
# CHECK-DAG: st1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3f 0x00 0x00}
# CHECK-DAG: st2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# CHECK-DAG: st3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80}
# CHECK-DAG: st4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x7f}
# CHECK-DAG: st5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0xff}
# CHECK-DAG: st6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xff 0xff}
# CHECK-DAG: st7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# CHECK-DAG: st{{(mm)?}}0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0x00 0x40}
# CHECK-DAG: st{{(mm)?}}1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3f 0x00 0x00}
# CHECK-DAG: st{{(mm)?}}2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# CHECK-DAG: st{{(mm)?}}3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80}
# CHECK-DAG: st{{(mm)?}}4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x7f}
# CHECK-DAG: st{{(mm)?}}5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0xff}
# CHECK-DAG: st{{(mm)?}}6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xff 0xff}
# CHECK-DAG: st{{(mm)?}}7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
# fdiv (%rbx) gets encoded into 2 bytes, int3 into 1 byte
print (void*)($pc-3)