From ef19f00de14a9c2c253c1c9b1119e1617280e3f2 Mon Sep 17 00:00:00 2001 From: sdeadmin Date: Sun, 17 Apr 2022 12:06:04 +0300 Subject: [PATCH] External Release v2022.04.17 Added: - Added AMX classifier API: xed_classify_amx() - Added CPUID bit definition for [F,]CMOV*, FCOMI* and MMX technology - Added AMX tests Modified: - Modified xed versioning to .. - Improved re-encoding of vector instructions Fixed: - Fixed [LD,ST]TILECFG memory width definition - Fixed MOV[H,L,LH,HL]P[S,D] register's access definition - Fixed [,V]MASKMOVDQU register's element type - Fixed RING0 attribute for CLAC and STAC - Fixed JKZD/JKNZD VEX.L bit (intelxed/xed#282) - Fixed KNC build and decoder - Fixed Clang13 build error for "-Werror=sign-compare" flag --- .github/scripts/ci_external.py | 168 +++++++++++ .github/workflows/ci.yml | 38 --- .github/workflows/ci_external.yml | 25 ++ .github/workflows/external_release.yml | 81 +++++ .gitignore | 2 + .gitlab-ci.yml | 35 --- .travis.yml | 23 -- VERSION | 2 +- appveyor.yml | 4 - ci-internal.py | 280 ------------------ ci.py | 55 ---- datafiles/amx-spr/amx-operand-widths.txt | 1 + datafiles/amx-spr/amx-spr-isa.xed.txt | 4 +- datafiles/avx/avx-isa.txt | 2 +- datafiles/cpuid.xed.txt | 15 +- datafiles/keylocker/widths.txt | 1 - datafiles/knc/jkbr-isa.txt | 12 +- datafiles/smap/smap-isa.xed.txt | 4 +- datafiles/xed-chips.txt | 4 +- datafiles/xed-fields.txt | 4 + datafiles/xed-isa.txt | 41 ++- docsrc/xed-build.txt | 16 +- docsrc/xed-doc-top.txt | 1 - examples/udhelp.cpp | 13 + examples/xed-asmparse.c | 4 + examples/xed-disas-elf.c | 4 + examples/xed-disas-filter.c | 77 ++--- examples/xed-disas-hex.c | 5 + examples/xed-disas-pecoff.cpp | 2 + examples/xed-enc-lang.c | 15 +- examples/xed-ex1.c | 7 +- examples/xed-examples-util.c | 4 +- examples/xed-find-special.c | 6 +- examples/xed.c | 22 +- include/public/xed/xed-decoded-inst-api.h | 3 + include/public/xed/xed-version.h | 2 +- mfile.py | 11 +- pysrc/classifier.py | 6 +- pysrc/codegen.py | 1 - pysrc/enc2gen.py | 13 +- pysrc/enum_txt_writer.py | 1 - pysrc/enumer.py | 1 - pysrc/gen-enum.py | 1 - pysrc/genutil.py | 1 - pysrc/ildutil.py | 1 - pysrc/metaenum.py | 1 - pysrc/slash_expand.py | 1 - src/common/xed-version.c | 6 +- src/dec/xed-decoded-inst.c | 2 + src/dec/xed-ild.c | 29 +- tests/REBASE.TESTS | 2 +- tests/RECREATE.TESTS | 2 + tests/RUN.TESTS | 2 +- tests/bulk-tests/amx-bulk-tests.txt | 10 + tests/bulk-tests/avx512x-bulk-tests.txt | 3 + tests/bulk-tests/bulk-tests.txt | 6 +- tests/bulk-tests/new-tests.txt | 6 +- tests/run-cmd.py | 10 +- tests/tests-amx/test-00000/cmd | 1 + tests/tests-amx/test-00000/codes | 1 + tests/tests-amx/test-00000/retcode.reference | 1 + tests/tests-amx/test-00000/stderr.reference | 0 tests/tests-amx/test-00000/stdout.reference | 10 + tests/tests-amx/test-00001/cmd | 1 + tests/tests-amx/test-00001/codes | 1 + tests/tests-amx/test-00001/retcode.reference | 1 + tests/tests-amx/test-00001/stderr.reference | 0 tests/tests-amx/test-00001/stdout.reference | 10 + tests/tests-amx/test-00002/cmd | 1 + tests/tests-amx/test-00002/codes | 1 + tests/tests-amx/test-00002/retcode.reference | 1 + tests/tests-amx/test-00002/stderr.reference | 0 tests/tests-amx/test-00002/stdout.reference | 10 + tests/tests-amx/test-00003/cmd | 1 + tests/tests-amx/test-00003/codes | 1 + tests/tests-amx/test-00003/retcode.reference | 1 + tests/tests-amx/test-00003/stderr.reference | 0 tests/tests-amx/test-00003/stdout.reference | 10 + tests/tests-amx/test-00004/cmd | 1 + tests/tests-amx/test-00004/codes | 1 + tests/tests-amx/test-00004/retcode.reference | 1 + tests/tests-amx/test-00004/stderr.reference | 0 tests/tests-amx/test-00004/stdout.reference | 10 + tests/tests-amx/test-00005/cmd | 1 + tests/tests-amx/test-00005/codes | 1 + tests/tests-amx/test-00005/retcode.reference | 1 + tests/tests-amx/test-00005/stderr.reference | 0 tests/tests-amx/test-00005/stdout.reference | 10 + tests/tests-amx/test-00006/cmd | 1 + tests/tests-amx/test-00006/codes | 1 + tests/tests-amx/test-00006/retcode.reference | 1 + tests/tests-amx/test-00006/stderr.reference | 0 tests/tests-amx/test-00006/stdout.reference | 10 + tests/tests-amx/test-00007/cmd | 1 + tests/tests-amx/test-00007/codes | 1 + tests/tests-amx/test-00007/retcode.reference | 1 + tests/tests-amx/test-00007/stderr.reference | 0 tests/tests-amx/test-00007/stdout.reference | 10 + tests/tests-amx/test-00008/cmd | 1 + tests/tests-amx/test-00008/codes | 1 + tests/tests-amx/test-00008/retcode.reference | 1 + tests/tests-amx/test-00008/stderr.reference | 0 tests/tests-amx/test-00008/stdout.reference | 10 + tests/tests-amx/test-00009/cmd | 1 + tests/tests-amx/test-00009/codes | 1 + tests/tests-amx/test-00009/retcode.reference | 1 + tests/tests-amx/test-00009/stderr.reference | 0 tests/tests-amx/test-00009/stdout.reference | 28 ++ tests/tests-avx512/test-00025/cmd | 1 + tests/tests-avx512/test-00025/codes | 1 + .../tests-avx512/test-00025/retcode.reference | 1 + .../tests-avx512/test-00025/stderr.reference | 0 .../tests-avx512/test-00025/stdout.reference | 10 + tests/tests-avx512/test-00026/cmd | 1 + tests/tests-avx512/test-00026/codes | 1 + .../tests-avx512/test-00026/retcode.reference | 1 + .../tests-avx512/test-00026/stderr.reference | 0 .../tests-avx512/test-00026/stdout.reference | 2 + tests/tests-avx512/test-00027/cmd | 1 + tests/tests-avx512/test-00027/codes | 1 + .../tests-avx512/test-00027/retcode.reference | 1 + .../tests-avx512/test-00027/stderr.reference | 0 .../tests-avx512/test-00027/stdout.reference | 2 + tests/tests-base/test-00150/stdout.reference | 2 +- tests/tests-base/test-00182/stdout.reference | 4 + tests/tests-base/test-00183/stdout.reference | 4 + tests/tests-base/test-00305/cmd | 2 +- tests/tests-base/test-00305/codes | 2 +- tests/tests-base/test-00305/stdout.reference | 8 - tests/tests-base/test-00306/cmd | 2 +- tests/tests-base/test-00306/codes | 2 +- tests/tests-base/test-00306/stdout.reference | 8 - tests/tests-base/test-00307/cmd | 2 +- tests/tests-base/test-00307/codes | 2 +- tests/tests-base/test-00307/stdout.reference | 8 - tests/tests-base/test-00517/codes | 2 +- tests/tests-base/test-00518/codes | 2 +- tests/tests-base/test-00519/codes | 2 +- tests/tests-base/test-00533/stdout.reference | 2 + tests/tests-base/test-00534/stdout.reference | 2 + xed_mbuild.py | 112 +++---- 141 files changed, 761 insertions(+), 676 deletions(-) create mode 100644 .github/scripts/ci_external.py delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/ci_external.yml create mode 100644 .github/workflows/external_release.yml delete mode 100644 .gitlab-ci.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 ci-internal.py delete mode 100644 ci.py create mode 100644 tests/bulk-tests/amx-bulk-tests.txt create mode 100644 tests/tests-amx/test-00000/cmd create mode 100644 tests/tests-amx/test-00000/codes create mode 100644 tests/tests-amx/test-00000/retcode.reference create mode 100644 tests/tests-amx/test-00000/stderr.reference create mode 100644 tests/tests-amx/test-00000/stdout.reference create mode 100644 tests/tests-amx/test-00001/cmd create mode 100644 tests/tests-amx/test-00001/codes create mode 100644 tests/tests-amx/test-00001/retcode.reference create mode 100644 tests/tests-amx/test-00001/stderr.reference create mode 100644 tests/tests-amx/test-00001/stdout.reference create mode 100644 tests/tests-amx/test-00002/cmd create mode 100644 tests/tests-amx/test-00002/codes create mode 100644 tests/tests-amx/test-00002/retcode.reference create mode 100644 tests/tests-amx/test-00002/stderr.reference create mode 100644 tests/tests-amx/test-00002/stdout.reference create mode 100644 tests/tests-amx/test-00003/cmd create mode 100644 tests/tests-amx/test-00003/codes create mode 100644 tests/tests-amx/test-00003/retcode.reference create mode 100644 tests/tests-amx/test-00003/stderr.reference create mode 100644 tests/tests-amx/test-00003/stdout.reference create mode 100644 tests/tests-amx/test-00004/cmd create mode 100644 tests/tests-amx/test-00004/codes create mode 100644 tests/tests-amx/test-00004/retcode.reference create mode 100644 tests/tests-amx/test-00004/stderr.reference create mode 100644 tests/tests-amx/test-00004/stdout.reference create mode 100644 tests/tests-amx/test-00005/cmd create mode 100644 tests/tests-amx/test-00005/codes create mode 100644 tests/tests-amx/test-00005/retcode.reference create mode 100644 tests/tests-amx/test-00005/stderr.reference create mode 100644 tests/tests-amx/test-00005/stdout.reference create mode 100644 tests/tests-amx/test-00006/cmd create mode 100644 tests/tests-amx/test-00006/codes create mode 100644 tests/tests-amx/test-00006/retcode.reference create mode 100644 tests/tests-amx/test-00006/stderr.reference create mode 100644 tests/tests-amx/test-00006/stdout.reference create mode 100644 tests/tests-amx/test-00007/cmd create mode 100644 tests/tests-amx/test-00007/codes create mode 100644 tests/tests-amx/test-00007/retcode.reference create mode 100644 tests/tests-amx/test-00007/stderr.reference create mode 100644 tests/tests-amx/test-00007/stdout.reference create mode 100644 tests/tests-amx/test-00008/cmd create mode 100644 tests/tests-amx/test-00008/codes create mode 100644 tests/tests-amx/test-00008/retcode.reference create mode 100644 tests/tests-amx/test-00008/stderr.reference create mode 100644 tests/tests-amx/test-00008/stdout.reference create mode 100644 tests/tests-amx/test-00009/cmd create mode 100644 tests/tests-amx/test-00009/codes create mode 100644 tests/tests-amx/test-00009/retcode.reference create mode 100644 tests/tests-amx/test-00009/stderr.reference create mode 100644 tests/tests-amx/test-00009/stdout.reference create mode 100644 tests/tests-avx512/test-00025/cmd create mode 100644 tests/tests-avx512/test-00025/codes create mode 100644 tests/tests-avx512/test-00025/retcode.reference create mode 100644 tests/tests-avx512/test-00025/stderr.reference create mode 100644 tests/tests-avx512/test-00025/stdout.reference create mode 100644 tests/tests-avx512/test-00026/cmd create mode 100644 tests/tests-avx512/test-00026/codes create mode 100644 tests/tests-avx512/test-00026/retcode.reference create mode 100644 tests/tests-avx512/test-00026/stderr.reference create mode 100644 tests/tests-avx512/test-00026/stdout.reference create mode 100644 tests/tests-avx512/test-00027/cmd create mode 100644 tests/tests-avx512/test-00027/codes create mode 100644 tests/tests-avx512/test-00027/retcode.reference create mode 100644 tests/tests-avx512/test-00027/stderr.reference create mode 100644 tests/tests-avx512/test-00027/stdout.reference diff --git a/.github/scripts/ci_external.py b/.github/scripts/ci_external.py new file mode 100644 index 00000000..2b77dca3 --- /dev/null +++ b/.github/scripts/ci_external.py @@ -0,0 +1,168 @@ +# BEGIN_LEGAL +# +# Copyright (c) 2022 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# END_LEGAL +""" run CI checks """ +import os +import platform +import subprocess +import sys +from datetime import datetime +from typing import Dict + +sys.path = ['scripts'] + sys.path + + +class JobStatus: + """record job status (success, failure and (retval,job) list""" + def __init__(self): + self.jobs = 0 + self.fails = 0 + self.successes = 0 + self.start_time = datetime.now() + self.commands = [] # list of tuples of (retval, command) + + def __str__(self): + s = [f"JOBS: {self.jobs}, SUCCESSES: {self.successes}, FAILS: {self.fails}"] + + for index, (r, c) in enumerate(self.commands): + s.append(f"{index}: status: {r} cmd: {c}") + return os.linesep.join(s) + os.linesep + + def addjob(self, retval, cmd): + self.jobs += 1 + self.commands.append((retval, cmd)) + + def fail(self, retval, cmd): + self.fails += 1 + self.addjob(retval, cmd) + + def success(self, retval, cmd): + self.successes += 1 + self.addjob(retval, cmd) + + def merge(self, status): + """merge status object""" + self.jobs += status.jobs + self.fails += status.fails + self.successes += status.successes + self.commands.extend(status.commands) + + def pass_rate_fraction(self): + return f'{self.successes}/{self.jobs}' + + +def success(status): + sys.stdout.write(str(status)) + sys.stdout.write(f'[ELAPSED TIME] {datetime.now() - status.start_time}\n') + sys.stdout.write("[FINAL STATUS] PASS\n") + sys.stdout.flush() + sys.exit(0) + + +def fail(status): + sys.stdout.write(str(status)) + sys.stdout.write(f'[ELAPSED TIME] {datetime.now() - status.start_time}\n') + sys.stdout.write("[FINAL STATUS] FAIL\n") + sys.stdout.flush() + sys.exit(1) + + +def ensure_string(x): + '''handle non unicode output''' + if isinstance(x, bytes): + return x.decode('utf-8') + return x + + +def run_subprocess(cmd, **kwargs): + '''front end to running subprocess''' + sub = subprocess.Popen(cmd, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + **kwargs) + lines = sub.stdout.readlines() + lines = [ensure_string(x) for x in lines] + sub.wait() + return sub.returncode, lines + + +def run(status:JobStatus, cmd, required=False, cwd=None): + """run subprocess, and record fails""" + print(cmd, flush=True) + retval, output = run_subprocess(cmd, cwd=cwd) + for line in output: + sys.stdout.write(line) + if retval == 0: + print("[SUCCESS]") + status.success(retval, cmd) + else: + print(f"[FAIL] retval = {retval}") + status.fail(retval, cmd) + if required: + fail(status) + return retval == 0 # 1=ok! + + +def get_python_cmds(): + '''find python verions. return tuples of (name, command)''' + if platform.system() == 'Windows': + for x in ['37']: + p_path = f'C:/python{x}/python' + if os.path.exists(p_path): + return [(x, p_path)] + if platform.system() in ['Darwin', 'Linux']: + # The file .travis.yml installs python3 on linux. Already present on mac + return [('3.x', 'python3')] + return [('dfltpython', 'python')] + + +def main(): + status = JobStatus() + + for pyver, pycmd in get_python_cmds(): + cmd = f'{pycmd} -m pip install --user ./mbuild' + run(status, cmd, required=True) + + # {32b,64b} x {shared,dynamic} link + for size in ['ia32', 'x86-64']: + for linkkind, link in [('static', ''), ('dynamic', '--shared')]: + build_dir = f'obj-general-{pyver}-{size}-{linkkind}' + cmd = f'{pycmd} mfile.py --build-dir={build_dir} host_cpu={size} {link} test' + run(status, cmd) + + # do a build with asserts enabled + build_dir = f'obj-assert-{pyver}-{"x86-64"}' + cmd = f'{pycmd} mfile.py --asserts --build-dir={build_dir} host_cpu={"x86-64"} test' + run(status, cmd) + + # knc test + size = 'x86-64' + linkkind = 'static' + build_dir = f'obj-knc-{pyver}-{size}-{linkkind}' + cmd = f'{pycmd} mfile.py --knc --build-dir={build_dir} host_cpu={size} test' + run(status, cmd) + + + if status.fails == 0: + success(status) + fail(status) + + +if __name__ == "__main__": + main() + sys.exit(0) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 8835a662..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,38 +0,0 @@ -on: [push, pull_request] - -jobs: - linux: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: Install prerequisites - run: | - python -m pip install --quiet --upgrade pip setuptools - sudo apt-get install -qq gcc-multilib - - name: test - run: | - python ci.py - macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: Install prerequisites - run: | - python -m pip install --quiet --upgrade pip setuptools - - name: test - run: | - python ci.py - - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - name: Install prerequisites - run: | - python -m pip install --quiet --upgrade pip setuptools - - name: test - run: | - python ci.py diff --git a/.github/workflows/ci_external.yml b/.github/workflows/ci_external.yml new file mode 100644 index 00000000..fa3cf579 --- /dev/null +++ b/.github/workflows/ci_external.yml @@ -0,0 +1,25 @@ +name: External Test +on: + pull_request: + branches: + - external +jobs: + test: + runs-on: + - self-hosted + - xed-runners + container: + image: ger-is-registry.caas.intel.com/bit/xed:latest + steps: + - name: Checkout xed + uses: actions/checkout@v2 + - name: Checkout mbuild + uses: actions/checkout@v2 + with: + repository: intelxed/mbuild + ref: main + path: mbuild + token: ${{ secrets.PAT }} + - name: test + run: | + python3 .github/scripts/ci_external.py diff --git a/.github/workflows/external_release.yml b/.github/workflows/external_release.yml new file mode 100644 index 00000000..b0c92b0c --- /dev/null +++ b/.github/workflows/external_release.yml @@ -0,0 +1,81 @@ +name: External release +on: + push: + branches: + - external + +jobs: + external_release: + runs-on: + - self-hosted + - xed-runners + steps: + - name: Checkout external branch + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT }} + fetch-depth: 0 + ref: external + path: external + - name: Get external commit message description + id: commit-body + run: | + cd external + echo + echo "$(git log -1 --pretty=%B)" >> ../body.txt + - name: Checkout main + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT }} + fetch-depth: 0 + ref: main + path: main + - name: Get version + id: get-version + run: echo "::set-output name=version::$(cat external/VERSION)" + - name: Git config + uses: ./main/.github/actions/set-git-credentials + with: + token: ${{ secrets.PAT }} + path: main + remote: origin + - name: Replace .rc with .external tag on main + run: | + cd main + set tag_sha=$(git rev-list -n 1 "${{steps.get-version.outputs.version}}.rc") + echo $tag_sha + git push --delete origin "${{steps.get-version.outputs.version}}.external" || true + git push --delete origin "${{steps.get-version.outputs.version}}.rc" || true + git tag -d "${{steps.get-version.outputs.version}}.rc" || true + git tag --force "${{steps.get-version.outputs.version}}.external" -a -F ../body.txt $tag_sha + git push origin "${{steps.get-version.outputs.version}}.external" + - name: Git config + uses: ./main/.github/actions/set-git-credentials + with: + token: ${{ secrets.PAT }} + path: external + remote: origin + - name: Tag external branch + run: | + cd external + git push --delete origin "${{steps.get-version.outputs.version}}" || true + git tag -d "${{steps.get-version.outputs.version}}" || true + git tag --force "${{steps.get-version.outputs.version}}" -a -F ../body.txt ${{ github.sha }} + git push origin "${{steps.get-version.outputs.version}}" + - name: Git config external repo + uses: ./main/.github/actions/set-git-credentials + with: + token: ${{ secrets.PAT }} + path: external + remote: external + repository: ${{ secrets.EXTERNAL_REPO }} + - name: Push to external repo + run: | + cd external + git push external HEAD:main + - name: Tag external repo + run: | + cd external + git push --delete external "${{steps.get-version.outputs.version}}" || true + git tag --force "${{steps.get-version.outputs.version}}" -a -F ../body.txt ${{ github.sha }} + git push external "${{steps.get-version.outputs.version}}" \ No newline at end of file diff --git a/.gitignore b/.gitignore index a81091ac..115aab21 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,8 @@ xed-install* TAGS /VS10/xed.vcxproj.user /VS10/xed.sdf +/.vs/ +.idea/ kits/* logs/* .developer diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index d6b52953..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -# .gitlab-ci.yml - -variables: - PACKAGE_NAME: xed - -build: - #image: ubuntu:18.04 - #image: xed-testing-container - image: amr-registry-pre.caas.intel.com/xed/xed-testing-container - stage: build - script: - - python3 ci-internal.py - -build-conan: - image: amr-registry.caas.intel.com/syssim/teamcity-agent:2020.1.5-21ww05 - stage: build - script: - - virtualenv --python="$(which python3)" ~/.syssim-virtualenv - - source ~/.syssim-virtualenv/bin/activate - - pip install conan pylint astroid yapf - - conan config install https://gitlab.devtools.intel.com/syssim/conan-config.git - - |- - if [[ $CI_COMMIT_REF_NAME == main && $CI_COMMIT_TAG == v* ]]; then - PACKAGE_REF=$PACKAGE_NAME/${CI_COMMIT_TAG#v*}@xed/stable - else - PACKAGE_REF=$PACKAGE_NAME/$CI_COMMIT_SHA@xed/ci - fi - conan create . $PACKAGE_REF --build=missing --profile=gcc9-native - if [[ $CI_COMMIT_REF_NAME == main && $CI_COMMIT_TAG == v* ]]; then - conan user -r syssim-public "$CONAN_USERNAME" -p "$CONAN_PASSWORD" - conan upload $PACKAGE_REF -r syssim-public --force - LATEST_REF=$PACKAGE_NAME/latest@xed/ci - conan alias $LATEST_REF $PACKAGE_REF - conan upload $LATEST_REF -r syssim-public --force - fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4243b834..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: c - -before_install: - - if [ `uname -s` = 'Linux' ]; then sudo apt-get install -y python3 python3-pip ; fi - -addons: - apt: - packages: - # 32 bit support - - gcc-multilib - -matrix: - include: - - compiler: gcc - os: linux - sudo: enabled - dist: xenial - - compiler: clang - os: osx - -script: - - sudo pip3 install --upgrade setuptools - - python3 ci.py diff --git a/VERSION b/VERSION index 02161ca8..d6baf621 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -13.0.0 +v2022.04.17 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b123a296..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,4 +0,0 @@ -build: off - -test_script: - - C:\Python37\python ci.py diff --git a/ci-internal.py b/ci-internal.py deleted file mode 100644 index 63a2c47f..00000000 --- a/ci-internal.py +++ /dev/null @@ -1,280 +0,0 @@ -#BEGIN_LEGAL -# -#Copyright (c) 2020 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#END_LEGAL -'''run CI checks on gitlab''' -import os -import sys -import platform -import subprocess -sys.path = ['scripts'] + sys.path -import send_sms - -class jobs_status_t: - '''record job status (success, failure and (retval,job) list''' - def __init__(self): - self.jobs = 0 - self.fails = 0 - self.successes = 0 - self.commands = [] # list of tuples of (retval, command) - - def __str__(self): - s = [] - s.append("JOBS: {}, SUCCESSES: {}, FAILS: {}".format( - self.jobs, self.successes, self.fails)) - i = 0 - for r, c in self.commands: - s.append("{}: status: {} cmd: {}".format(i, r, c)) - i = i+1 - return "\n".join(s) + '\n' - - def addjob(self, retval, cmd): - self.jobs += 1 - self.commands.append((retval, cmd)) - - def fail(self, retval, cmd): - self.fails += 1 - self.addjob(retval, cmd) - - def success(self, retval, cmd): - self.successes += 1 - self.addjob(retval, cmd) - - def pass_rate_fraction(self): - return '{}/{}'.format(self.successes, self.jobs) - - -def success(status): - '''send success SMS''' - sys.stdout.write("FINAL STATUS: PASS\n") - sys.stdout.write(str(status)) - sys.stdout.flush() - #send_sms.send("XED CI: Passed ({} passing)".format( - # status.pass_rate_fraction())) - sys.exit(0) - -def fail(status): - '''send failing SMS''' - sys.stdout.write("FINAL STATUS: FAIL\n") - sys.stdout.write(str(status)) - sys.stdout.flush() - #send_sms.send("XED CI: Failed ({} passing)".format( - # status.pass_rate_fraction())) - sys.exit(1) - -def ensure_string(x): - '''handle non unicode output''' - if isinstance(x, bytes): - return x.decode('utf-8') - return x - - -def run_subprocess(cmd, **kwargs): - '''front end to running subprocess''' - sub = subprocess.Popen(cmd, - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - **kwargs) - lines = sub.stdout.readlines() - lines = [ensure_string(x) for x in lines] - sub.wait() - return sub.returncode, lines - - -def run(status, cmd, required=False, cwd=None): - '''run subprocess, and record fails''' - print(cmd) - retval, output = run_subprocess(cmd, cwd=cwd) - for line in output: - sys.stdout.write(line) - if retval == 0: - print("[SUCCESS]") - status.success(retval, cmd) - else: - print("[FAIL] retval = {}".format(retval)) - status.fail(retval, cmd) - if required: - fail("Required task failed") - return retval == 0 # 1=ok! - -def get_python_cmds(): - '''find python verions. return tuples of (name, command)''' - if platform.system() == 'Windows': - return [(x, 'C:/python{}/python'.format(x)) for x in ['37']] - if platform.system() in ['Darwin', 'Linux']: - # The file .travis.yml installs python3 on linux. Already present on mac - return [('3.x', 'python3')] - return [('dfltpython', 'python')] - - - -def all_instr(pyver, pycmd, status, kind): - size = 'x86-64' - linkkind = 'static' - build_dir = 'obj-{}-{}-{}-{}'.format(kind, pyver, size, linkkind) - cwd = os.path.abspath(os.curdir) - flags = '--kind {} --enc2-test-checked'.format(kind) - cmd = '{} xedext/xed_build.py --xed-dir {} {} --build-dir={} host_cpu={}'.format( - pycmd, cwd, flags, build_dir, size) - ok = run(status, cmd) - - if ok: - cmd = '{}/enc2-m64-a64/enc2tester-enc2-m64-a64 --reps 1 --main --gnuasm > a.c'.format( - build_dir) - ok = run(status, cmd) - - if 1: # FIXME: ignore error code for now. - cmd = 'gcc a.c' - run(status, cmd) - - if ok: - cmd = '{}/wkit/bin/xed -i a.out > all.dis'.format(build_dir) - run(status, cmd) - -def archval(pyver, pycmd, status): - size = 'x86-64' - linkkind = 'static' - build_dir = 'obj-archval-{}-{}-{}'.format(pyver, size, linkkind) - cwd = os.path.abspath(os.curdir) - flags = '--kind architectural-val ' + os.getenv('ARCHVAL_OPTIONS') - cmd = '{} xedext/xed_build.py --xed-dir {} {} --build-dir={} host_cpu={}'.format( - pycmd, cwd, flags, build_dir, size) - run(status, cmd) - -def get_branches_from_file(): - f = open("misc/ci-branches.txt","r") - lines = f.readlines() - f.close() - d = {} - for x in lines: - x = x.strip() - a = x.split() - repo=a[0] - branch=a[1] - print("READING REPO: {} TO BRANCH: {}".format(repo, branch)) - d[repo]=branch - return d - -def checkout_branches(status, branches): - for repo,branch in branches.items(): - print("CHANGING REPO: {} TO BRANCH: {}".format(repo, branch)) - run(status, "git checkout {}".format(branch), cwd=repo) - -def main(): - status = jobs_status_t() - # FIXME: add knob for local use - # git_base = 'ssh://git@gitlab.devtools.intel.com/xed-group/' - git_base = 'https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.devtools.intel.com/xed-group/' - - mbuild_git = git_base + 'mbuild.git' - cmd = 'git clone {} mbuild'.format(mbuild_git) - run(status, cmd, required=True) - - # IPLDT scan XED and MBUILD - if 0: # disabled until get right branch - # obtain IPLDT scanner tool - bintools_git = git_base + 'binary-tools.git' - cmd = 'git clone --depth 1 {} binary-tools'.format(bintools_git) - run(status, cmd, required=True) - - # clone another copy of xed sources just for IPLDT scanning - # FIXME: need to get the branch we are testing! - xed_git = git_base + 'xed.git' - cmd = 'git clone --depth 1 {} xed'.format(xed_git) - run(status, cmd, required=True) - - cmd = 'binary-tools/lin/ipldt3 -i xed -r ipldt-results-xed' - run(status, cmd, required=False) - cmd = 'cat ipldt-results-xed/ipldt_results.txt' - run(status, cmd, required=True) - - cmd = 'binary-tools/lin/ipldt3 -i mbuild -r ipldt-results-mbuild' - run(status, cmd, required=False) - cmd = 'cat ipldt-results-mbuild/ipldt_resuplts.txt' - run(status, cmd, required=True) - - xedext_git = git_base + 'xedext.git' - cmd = 'git clone {} xedext'.format(xedext_git) - run(status, cmd, required=True) - - # check a few lines to make sure we have latest commits - cmd = 'git -C xedext log --oneline -5' - run(status, cmd, required=True) - - branches = get_branches_from_file() - checkout_branches(status, branches) - - - archval_repo = os.getenv('ARCHVAL_REPO') - if archval_repo: - archval_git = git_base + archval_repo - short_name = os.path.splitext(archval_repo)[0] - cmd = 'git clone {} {}'.format(archval_git, short_name) - run(status, cmd, required=True) - - for pyver, pycmd in get_python_cmds(): - - cmd = '{} -m pip install --user ./mbuild'.format(pycmd) - run(status, cmd, required=True) - - # {32b,64b} x {shared,dynamic} link - for size in ['ia32', 'x86-64']: - for linkkind, link in [('static', ''), ('dynamic', '--shared')]: - build_dir = 'obj-general-{}-{}-{}'.format(pyver, size, linkkind) - cmd = '{} mfile.py --build-dir={} host_cpu={} {} test'.format(pycmd, - build_dir, - size, - link) - run(status, cmd) - - # do a build with asserts enabled - build_dir = 'obj-assert-{}-{}'.format(pyver, 'x86-64') - cmd = '{} mfile.py --asserts --build-dir={} host_cpu={} test'.format(pycmd, - build_dir, - 'x86-64') - run(status, cmd) - - # all instr tests - all_instr(pyver, pycmd, status, 'internal-conf') - all_instr(pyver, pycmd, status, 'external') - - # arch val test - archval(pyver, pycmd, status) - - - # knc test - if 0: - size = 'x86-64' - linkkind = 'static' - build_dir = 'obj-knc-{}-{}-{}'.format(pyver, size, linkkind) - cmd = '{} mfile.py --knc --build-dir={} host_cpu={} test'.format( - pycmd, build_dir, size) - run(status, cmd) - - if status.fails == 0: - success(status) - fail(status) - -def test(): - status = jobs_status_t() - status.success(1, 'foo') - status.success(1, 'bar') - fail(status) -if __name__ == "__main__": - #test() - main() - sys.exit(0) diff --git a/ci.py b/ci.py deleted file mode 100644 index 3d1fa977..00000000 --- a/ci.py +++ /dev/null @@ -1,55 +0,0 @@ -#BEGIN_LEGAL -# -#Copyright (c) 2019 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#END_LEGAL -'''Run CI checks on github''' -import os -import platform -import subprocess - - -def github_actions(): - return 'GITHUB_ACTIONS' in os.environ and os.environ['GITHUB_ACTIONS'] == 'true' - -def size_variants(): - if platform.system() == 'Darwin' and github_actions(): - # 32 bit deprecated in latest macos - return ['x86-64'] - else: - return ['ia32', 'x86-64'] - -def get_python_cmds(): - '''find python verions. return tuples of (name, command)''' - if github_actions(): - return [('3.x', 'python')] - if platform.system() == 'Windows': - return [(x, 'C:/python{}/python'.format(x)) for x in ['37']] - if platform.system() in ['Darwin', 'Linux']: - # The file .travis.yml installs python3 on linux. Already present on mac - return [('3.x', 'python3')] - return [('dfltpython', 'python')] - -for pyver, pycmd in get_python_cmds(): - cmd = '{} -m pip install --user https://github.com/intelxed/mbuild/zipball/main'.format(pycmd) - print(cmd) - subprocess.check_call(cmd, shell=True) - for size in size_variants(): - for linkkind, link in [('dfltlink', ''), ('dynamic', '--shared')]: - build_dir = '{}-{}-{}'.format(pyver, size, linkkind) - cmd = '{} mfile.py --build-dir=build-{} host_cpu={} {} test'.format( - pycmd, build_dir, size, link) - print(cmd) - subprocess.check_call(cmd, shell=True) diff --git a/datafiles/amx-spr/amx-operand-widths.txt b/datafiles/amx-spr/amx-operand-widths.txt index 31c7537a..364e7932 100644 --- a/datafiles/amx-spr/amx-operand-widths.txt +++ b/datafiles/amx-spr/amx-operand-widths.txt @@ -22,6 +22,7 @@ ptr u8 0 tmemrow u8 0 tmemcol u8 0 +m512 struct 64 # bytes # tiles are variable width based on palette so hard to really specify an overall width. tv u8 0 diff --git a/datafiles/amx-spr/amx-spr-isa.xed.txt b/datafiles/amx-spr/amx-spr-isa.xed.txt index bbad03dd..7c7d1b19 100644 --- a/datafiles/amx-spr/amx-spr-isa.xed.txt +++ b/datafiles/amx-spr/amx-spr-isa.xed.txt @@ -36,7 +36,7 @@ EXCEPTIONS: AMX-E1 REAL_OPCODE: Y ATTRIBUTES: NOTSX PATTERN: VV1 0x49 VNP V0F38 MOD[mm] MOD!=3 REG[0b000] RM[nnn] MODRM() VL128 W0 mode64 NOVSR -OPERANDS: MEM0:r:zd +OPERANDS: MEM0:r:m512 IFORM: LDTILECFG_MEM } @@ -52,7 +52,7 @@ EXCEPTIONS: AMX-E2 REAL_OPCODE: Y ATTRIBUTES: NOTSX PATTERN: VV1 0x49 V66 V0F38 MOD[mm] MOD!=3 REG[0b000] RM[nnn] MODRM() VL128 W0 mode64 NOVSR -OPERANDS: MEM0:w:zd +OPERANDS: MEM0:w:m512 IFORM: STTILECFG_MEM } diff --git a/datafiles/avx/avx-isa.txt b/datafiles/avx/avx-isa.txt index e0fbb926..f8334f77 100644 --- a/datafiles/avx/avx-isa.txt +++ b/datafiles/avx/avx-isa.txt @@ -4312,7 +4312,7 @@ CATEGORY : AVX EXTENSION : AVX ATTRIBUTES : maskop fixed_base0 NOTSX NONTEMPORAL PATTERN : VV1 0xF7 V0F V66 VL128 NOVSR MOD[0b11] MOD=3 REG[rrr] RM[nnn] -OPERANDS : REG0=XMM_R():r:dq:u8 REG1=XMM_B():r:dq:u8 MEM0:w:SUPP:dq:u8 BASE0=ArDI():r:SUPP SEG0=FINAL_DSEG():r:SUPP +OPERANDS : REG0=XMM_R():r:xub REG1=XMM_B():r:xub MEM0:w:SUPP:xub BASE0=ArDI():r:SUPP SEG0=FINAL_DSEG():r:SUPP } #################################################################################### diff --git a/datafiles/cpuid.xed.txt b/datafiles/cpuid.xed.txt index df63a4c4..5d24d83e 100644 --- a/datafiles/cpuid.xed.txt +++ b/datafiles/cpuid.xed.txt @@ -38,7 +38,7 @@ XED_ISA_SET_LONGMODE: intel64.80000001.0.edx.29 XED_ISA_SET_MOVBE: movebe.1.0.ecx.22 XED_ISA_SET_PAUSE: n/a XED_ISA_SET_PCLMULQDQ: pclmulqdq.1.0.ecx.1 -XED_ISA_SET_PENTIUMMMX: n/a +XED_ISA_SET_PENTIUMMMX: mmx.1.0.edx.23 XED_ISA_SET_PENTIUMREAL: n/a XED_ISA_SET_POPCNT: popcnt.1.0.ecx.23 @@ -52,17 +52,22 @@ XED_ISA_SET_RDTSCP: rdtscp.80000001.0.edx.27 XED_ISA_SET_SMX: smx.1.0.ecx.6 XED_ISA_SET_SSE: sse.1.0.edx.25 XED_ISA_SET_SSE2: sse2.1.0.edx.26 -XED_ISA_SET_SSE2MMX: sse2.1.0.edx.26 +XED_ISA_SET_SSE2MMX: sse2.1.0.edx.26 mmx.1.0.edx.23 XED_ISA_SET_SSE3: sse3.1.0.ecx.0 -XED_ISA_SET_SSE3X87: sse3.1.0.ecx.0 -XED_ISA_SET_MONITOR: monitor.1.0.ecx.3 +XED_ISA_SET_SSE3X87: sse3.1.0.ecx.0 +XED_ISA_SET_MONITOR: monitor.1.0.ecx.3 XED_ISA_SET_SSE4: sse4.1.0.ecx.19 XED_ISA_SET_SSE42: sse42.1.0.ecx.20 XED_ISA_SET_SSEMXCSR: sse.1.0.edx.25 XED_ISA_SET_SSSE3: ssse3.1.0.ecx.9 -XED_ISA_SET_SSSE3MMX: ssse3.1.0.ecx.9 +XED_ISA_SET_SSSE3MMX: ssse3.1.0.ecx.9 mmx.1.0.edx.23 XED_ISA_SET_VTX: vmx.1.0.ecx.5 XED_ISA_SET_X87: n/a + +XED_ISA_SET_CMOV: cmov.1.0.edx.15 +XED_ISA_SET_FCMOV: cmov.1.0.edx.15 fpu.1.0.edx.0 +XED_ISA_SET_FCOMI: cmov.1.0.edx.15 fpu.1.0.edx.0 + diff --git a/datafiles/keylocker/widths.txt b/datafiles/keylocker/widths.txt index 5085cdd9..8ffb364b 100644 --- a/datafiles/keylocker/widths.txt +++ b/datafiles/keylocker/widths.txt @@ -17,4 +17,3 @@ #END_LEGAL m384 struct 48 # bytes -m512 struct 64 # bytes diff --git a/datafiles/knc/jkbr-isa.txt b/datafiles/knc/jkbr-isa.txt index fb38b8be..d8f4aea0 100644 --- a/datafiles/knc/jkbr-isa.txt +++ b/datafiles/knc/jkbr-isa.txt @@ -24,7 +24,7 @@ CPL: 3 CATEGORY: COND_BR EXTENSION: KNCV ISA_SET: KNCJKBR -PATTERN: VV1 0x75 VNP VMAP0 W0 BRDISP8() +PATTERN: VV1 0x75 VNP VL128 VMAP0 W0 BRDISP8() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:b IFORM: JKNZD_MASKmskw_RELBRb_KNC @@ -37,10 +37,10 @@ CATEGORY: COND_BR EXTENSION: KNCV ISA_SET: KNCJKBR -PATTERN: VV1 0x85 VNP not64 V0F W0 BRDISPz() +PATTERN: VV1 0x85 VNP VL128 not64 V0F W0 BRDISPz() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:z -PATTERN: VV1 0x85 VNP mode64 V0F W0 BRDISP32() +PATTERN: VV1 0x85 VNP VL128 mode64 V0F W0 BRDISP32() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:z IFORM: JKNZD_MASKmskw_RELBRz_KNC @@ -53,7 +53,7 @@ CPL: 3 CATEGORY: COND_BR EXTENSION: KNCV ISA_SET: KNCJKBR -PATTERN: VV1 0x74 VNP VMAP0 W0 BRDISP8() +PATTERN: VV1 0x74 VNP VL128 VMAP0 W0 BRDISP8() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:b IFORM: JKZD_MASKmskw_RELBRb_KNC @@ -67,10 +67,10 @@ CATEGORY: COND_BR EXTENSION: KNCV ISA_SET: KNCJKBR -PATTERN: VV1 0x84 not64 VNP V0F W0 BRDISPz() +PATTERN: VV1 0x84 not64 VNP VL128 V0F W0 BRDISPz() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:z -PATTERN: VV1 0x84 mode64 VNP V0F W0 BRDISP32() +PATTERN: VV1 0x84 mode64 VNP VL128 V0F W0 BRDISP32() OPERANDS: REG0=MASK_N():w:mskw RELBR:r:z IFORM: JKZD_MASKmskw_RELBRz_KNC diff --git a/datafiles/smap/smap-isa.xed.txt b/datafiles/smap/smap-isa.xed.txt index 5983a1ba..027199e0 100644 --- a/datafiles/smap/smap-isa.xed.txt +++ b/datafiles/smap/smap-isa.xed.txt @@ -1,6 +1,6 @@ #BEGIN_LEGAL # -#Copyright (c) 2019 Intel Corporation +#Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ INSTRUCTIONS():: { ICLASS : CLAC +ATTRIBUTES: RING0 CPL : 0 CATEGORY : SMAP EXTENSION : SMAP @@ -31,6 +32,7 @@ OPERANDS : { ICLASS : STAC +ATTRIBUTES: RING0 CPL : 0 CATEGORY : SMAP EXTENSION : SMAP diff --git a/datafiles/xed-chips.txt b/datafiles/xed-chips.txt index f5c1c43a..a6ea38ca 100644 --- a/datafiles/xed-chips.txt +++ b/datafiles/xed-chips.txt @@ -59,12 +59,12 @@ ALLREAL: ALL_OF(PENTIUMMMXREAL) # P6, PentiumPro, PPRO: # The SSE_PREFETCH were on P6 as fat NOPs, but XED only recognizes them on >=PENTIUM3 -PENTIUMPRO: ALL_OF(PENTIUM) PPRO PPRO_UD0_SHORT CMOV FCMOV RDPMC FAT_NOP PREFETCH_NOP # NO MMX (Orig P6) +PENTIUMPRO: ALL_OF(PENTIUM) PPRO PPRO_UD0_SHORT CMOV FCMOV FCOMI RDPMC FAT_NOP PREFETCH_NOP # NO MMX (Orig P6) # FCMOV*, CMOV*, RDPMC, SYSCALL, SYSENTER, SYSEXIT,SYSRET, UD2, F[U]COMI[P] # note conflict with PENTIUM2 addition of SYSENTER/SYSEXIT -PENTIUM2: ALL_OF(PENTIUM) PENTIUMMMX PPRO CMOV FCMOV FAT_NOP RDPMC PREFETCH_NOP FXSAVE +PENTIUM2: ALL_OF(PENTIUM) PENTIUMMMX PPRO CMOV FCMOV FCOMI FAT_NOP RDPMC PREFETCH_NOP FXSAVE # FXSAVE/FXRSTOR, SYSENTER,SYSEXIT P6 # we keep SSEMXCSR separate from SSE to accommodate chip-check for KNC diff --git a/datafiles/xed-fields.txt b/datafiles/xed-fields.txt index 6078f7de..2fb3165b 100644 --- a/datafiles/xed-fields.txt +++ b/datafiles/xed-fields.txt @@ -218,3 +218,7 @@ MODRM_BYTE SCALAR xed_bits_t 8 SUPPRESSED NOPRINT INTERNAL DO EI ESRC SCALAR xed_bits_t 4 SUPPRESSED NOPRINT INTERNAL DO EO VEXVALID SCALAR xed_bits_t 3 SUPPRESSED NOPRINT INTERNAL DO EO DUMMY SCALAR xed_bits_t 1 SUPPRESSED NOPRINT INTERNAL DO EI + +# Disable decoder VEX/EVEX space +NO_EVEX SCALAR xed_bits_t 1 SUPPRESSED NOPRINT INTERNAL DI EO +NO_VEX SCALAR xed_bits_t 1 SUPPRESSED NOPRINT INTERNAL DI EO diff --git a/datafiles/xed-isa.txt b/datafiles/xed-isa.txt index e22755de..f5fbfd7e 100644 --- a/datafiles/xed-isa.txt +++ b/datafiles/xed-isa.txt @@ -950,7 +950,7 @@ ATTRIBUTES: NOTSX CPL : 3 CATEGORY : X87_ALU EXTENSION : X87 -ISA_SET : PPRO +ISA_SET : FCOMI FLAGS : MUST [ zf-mod pf-mod cf-mod af-0 sf-0 of-0 fc1-mod ] PATTERN : 0xDB MOD[0b11] MOD=3 REG[0b101] RM[nnn] OPERANDS : REG0=XED_REG_ST0:r:IMPL:f80 REG1=X87():r:f80 REG2=XED_REG_X87STATUS:w:SUPP @@ -961,7 +961,7 @@ ATTRIBUTES: NOTSX CPL : 3 CATEGORY : X87_ALU EXTENSION : X87 -ISA_SET : PPRO +ISA_SET : FCOMI FLAGS : MUST [ zf-mod pf-mod cf-mod af-0 sf-0 of-0 fc1-mod ] PATTERN : 0xDB MOD[0b11] MOD=3 REG[0b110] RM[nnn] OPERANDS : REG0=XED_REG_ST0:r:IMPL:f80 REG1=X87():r:f80 REG2=XED_REG_X87STATUS:w:SUPP @@ -1511,7 +1511,7 @@ ATTRIBUTES: NOTSX CPL : 3 CATEGORY : X87_ALU EXTENSION : X87 -ISA_SET : PPRO +ISA_SET : FCOMI FLAGS : MUST [ zf-mod pf-mod cf-mod af-0 sf-0 of-0 fc1-mod ] PATTERN : 0xDF MOD[0b11] MOD=3 REG[0b101] RM[nnn] OPERANDS : REG0=XED_REG_ST0:r:IMPL:f80 REG1=X87():r:f80 REG2=XED_REG_X87POP:r:SUPP REG3=XED_REG_X87STATUS:w:SUPP @@ -1522,7 +1522,7 @@ ATTRIBUTES: NOTSX CPL : 3 CATEGORY : X87_ALU EXTENSION : X87 -ISA_SET : PPRO +ISA_SET : FCOMI FLAGS : MUST [ zf-mod pf-mod cf-mod af-0 sf-0 of-0 fc1-mod ] PATTERN : 0xDF MOD[0b11] MOD=3 REG[0b110] RM[nnn] OPERANDS : REG0=XED_REG_ST0:r:IMPL:f80 REG1=X87():r:f80 REG2=XED_REG_X87POP:r:SUPP REG3=XED_REG_X87STATUS:w:SUPP @@ -4646,11 +4646,6 @@ PATTERN : 0x0F 0x18 MOD[0b11] MOD=3 REG[0b011] RM[nnn] OPERANDS : REG0=GPRv_B():r IFORM : NOP_GPRv_0F18r3 - -PATTERN : 0x0F 0x18 MOD[mm] MOD!=3 REG[0b100] RM[nnn] MODRM() -OPERANDS : MEM0:r:v -IFORM : NOP_MEMv_0F18r4 - PATTERN : 0x0F 0x18 MOD[0b11] MOD=3 REG[0b100] RM[nnn] OPERANDS : REG0=GPRv_B():r IFORM : NOP_GPRv_0F18r4 @@ -4672,6 +4667,20 @@ OPERANDS : REG0=GPRv_B():r IFORM : NOP_GPRv_0F18r7 } +{ +ICLASS : NOP +CPL : 3 +UNAME : NOP0F18r4 +CATEGORY : WIDENOP +ATTRIBUTES: NOP +EXTENSION : BASE +ISA_SET : FAT_NOP + +PATTERN : 0x0F 0x18 MOD[mm] MOD!=3 REG[0b100] RM[nnn] MODRM() +OPERANDS : MEM0:r:v +IFORM : NOP_MEMv_0F18r4 +} + { ICLASS : NOP CPL : 3 @@ -5006,7 +5015,7 @@ CATEGORY : DATAXFER EXTENSION : SSE EXCEPTIONS: SSE_TYPE_7 PATTERN : 0x0F 0x12 no_refining_prefix MOD[0b11] MOD=3 REG[rrr] RM[nnn] -OPERANDS : REG0=XMM_R():w:q:f32 REG1=XMM_B():r:q:f32 +OPERANDS : REG0=XMM_R():rw:q:f32 REG1=XMM_B():r:q:f32 } { ICLASS : MOVLPS @@ -5016,7 +5025,7 @@ EXTENSION : SSE EXCEPTIONS: SSE_TYPE_5 ATTRIBUTES : PATTERN : 0x0F 0x12 no_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM() -OPERANDS : REG0=XMM_R():w:q:f32 MEM0:r:q:f32 +OPERANDS : REG0=XMM_R():rw:q:f32 MEM0:r:q:f32 } { ICLASS : MOVLHPS @@ -5025,7 +5034,7 @@ CATEGORY : DATAXFER EXTENSION : SSE EXCEPTIONS: SSE_TYPE_7 PATTERN : 0x0F 0x16 no_refining_prefix MOD[0b11] MOD=3 REG[rrr] RM[nnn] -OPERANDS : REG0=XMM_R():w:q:f32 REG1=XMM_B():r:q:f32 +OPERANDS : REG0=XMM_R():rw:q:f32 REG1=XMM_B():r:q:f32 } { ICLASS : MOVHPS @@ -5035,7 +5044,7 @@ EXTENSION : SSE EXCEPTIONS: SSE_TYPE_5 ATTRIBUTES : PATTERN : 0x0F 0x16 no_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] MODRM() -OPERANDS : REG0=XMM_R():w:q:f32 MEM0:r:q:f32 +OPERANDS : REG0=XMM_R():rw:q:f32 MEM0:r:q:f32 } { ICLASS : ADD_LOCK @@ -8947,7 +8956,7 @@ EXTENSION : SSE2 EXCEPTIONS: SSE_TYPE_5 ATTRIBUTES : PATTERN : 0x0F 0x12 osz_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] REFINING66() MODRM() -OPERANDS : REG0=XMM_R():w:sd MEM0:r:q +OPERANDS : REG0=XMM_R():rw:sd MEM0:r:q PATTERN : 0x0F 0x13 osz_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] REFINING66() MODRM() OPERANDS : MEM0:w:q REG0=XMM_R():r:sd } @@ -8984,7 +8993,7 @@ EXTENSION : SSE2 EXCEPTIONS: SSE_TYPE_5 ATTRIBUTES : PATTERN : 0x0F 0x16 osz_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] REFINING66() MODRM() -OPERANDS : REG0=XMM_R():w:sd MEM0:r:q +OPERANDS : REG0=XMM_R():rw:sd MEM0:r:q PATTERN : 0x0F 0x17 osz_refining_prefix MOD[mm] MOD!=3 REG[rrr] RM[nnn] REFINING66() MODRM() OPERANDS : MEM0:w:q REG0=XMM_R():r:sd } @@ -11287,7 +11296,7 @@ EXTENSION : SSE2 EXCEPTIONS: SSE_TYPE_4 ATTRIBUTES : fixed_base0 maskop NOTSX NONTEMPORAL PATTERN : 0x0F 0xF7 osz_refining_prefix MOD[0b11] MOD=3 REG[rrr] RM[nnn] REFINING66() OVERRIDE_SEG0() -OPERANDS : REG0=XMM_R():r:dq REG1=XMM_B():r:dq MEM0:w:dq:SUPP BASE0=ArDI():r:SUPP SEG0=FINAL_DSEG():r:SUPP +OPERANDS : REG0=XMM_R():r:xub REG1=XMM_B():r:xub MEM0:w:SUPP:xub BASE0=ArDI():r:SUPP SEG0=FINAL_DSEG():r:SUPP } { ICLASS : LDDQU diff --git a/docsrc/xed-build.txt b/docsrc/xed-build.txt index 03217705..7c7482ce 100644 --- a/docsrc/xed-build.txt +++ b/docsrc/xed-build.txt @@ -1,5 +1,5 @@ #BEGIN_LEGAL -#Copyright (c) 2019 Intel Corporation +#Copyright (c) 2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ @else @mainpage *INTERNAL* XED Build Guide @endif -by Mark Charney 2019-05-28 @@ -74,8 +73,8 @@ git clone https://github.com/intelxed/mbuild.git mbuild @endcode @else @code -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/xed.git xed -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/mbuild.git mbuild +git clone {xed repository URL} xed +git clone {mbuild repository URL} mbuild @endcode @endif @@ -145,8 +144,8 @@ C:/Python37/python ../xed/mfile.py examples install zip @endcode @else @code -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/xed.git xed -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/mbuild.git mbuild +git clone {xed repository URL} xed +git clone {mbuild repository URL} mbuild mkdir test cd test C:/Python37/python ../xed/mfile.py examples install zip @@ -167,8 +166,8 @@ python ../xed/mfile.py examples install zip @endcode @else @code -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/xed.git xed -git clone ssh://git@gitlab.devtools.intel.com:29418/xed-group/mbuild.git mbuild +git clone {xed repository URL} xed +git clone {mbuild repository URL} mbuild mkdir test cd test python ../xed/mfile.py examples install zip @@ -399,7 +398,6 @@ Options: --python=PYTHONARG Use a specific version of python for subprocesses. --elf-dwarf, --dwarf Use libelf/libdwarf. (Linux only) - --dev Developer knob. Updates VERSION file --elf-dwarf-precompiled Use precompiled libelf/libdwarf from the XED source distribution. This is the currently required if you diff --git a/docsrc/xed-doc-top.txt b/docsrc/xed-doc-top.txt index 7eef8f19..c6dd6dee 100644 --- a/docsrc/xed-doc-top.txt +++ b/docsrc/xed-doc-top.txt @@ -22,7 +22,6 @@ // =========================================================================== /*! @mainpage X86 Encoder Decoder User Guide -by Mark Charney 2020-11-13 diff --git a/examples/udhelp.cpp b/examples/udhelp.cpp index b8f6e824..387b743a 100644 --- a/examples/udhelp.cpp +++ b/examples/udhelp.cpp @@ -61,6 +61,12 @@ BOOL CALLBACK dbg_help_client_t::enum_sym( dbg_help_client_t::dbg_help_client_t() { xed_symbol_table_init(&sym_tab); + error=0; + hProcess=INVALID_HANDLE_VALUE; + processId=0; + gBaseOfDll=0; + actual_base=0; + gModule=0; initialized=false; } @@ -92,6 +98,7 @@ static char* append3(const char* s1, const char* s2, const char* s3) { if (s2) n += xed_strlen(s2); if (s3) n += xed_strlen(s3); p = (char*) malloc(sizeof(char)*n); + assert(p != 0); n=xed_strncpy(p,s1,n); if (s2) n=xed_strncat(p,s2,n); if (s3) n=xed_strncat(p,s3,n); @@ -176,8 +183,12 @@ int dbg_help_client_t::init(char const* const path, if (_access_s(dbghelp,4) != 0) #endif { + free(dir); + free(dbghelp); return 0; } + free(dir); + free(dbghelp); SymSetOptions(SYMOPT_UNDNAME | SYMOPT_LOAD_LINES ); hProcess = GetCurrentProcess(); @@ -314,6 +325,8 @@ xed_bool_t dbg_help_client_t::get_file_and_line(xed_uint64_t address, *column = dw_column; *line = imgline.LineNumber; *filename =(char*) malloc(len+1); + if (*filename == 0) + return 0; // failed, out of memory xed_strncpy(*filename, imgline.FileName, len+1); return 1; //success } diff --git a/examples/xed-asmparse.c b/examples/xed-asmparse.c index 58954dfa..9c1299bd 100644 --- a/examples/xed-asmparse.c +++ b/examples/xed-asmparse.c @@ -829,12 +829,16 @@ static void parse_memref(char* s, opnd_list_t* onode) else if (stmp[i] == ':') { // can only end segment tbuf[p++]=0; p=0; + if (r.seg) + free(r.seg); r.seg = asp_strdup(tbuf); } else if (stmp[i] == '*') { // can end index tbuf[p++]=0; p=0; last_star=1; + if (r.index) + free(r.index); r.index=asp_strdup(tbuf); continue; // skip loop bottom } diff --git a/examples/xed-disas-elf.c b/examples/xed-disas-elf.c index 283a1978..2d9e80fa 100644 --- a/examples/xed-disas-elf.c +++ b/examples/xed-disas-elf.c @@ -201,6 +201,10 @@ static void read_dwarf_line_numbers(void* region, &file_name_table, file_num); line_number_entry_t* p = (line_number_entry_t*)malloc(sizeof(line_number_entry_t)); + if (p == 0) { + fprintf(stderr, "ERROR: Could not malloc\n"); + exit(1); + } line_number_entry_init(p, line_num, gfn); avl_insert(&line_number_table, line_addr, p, 1); diff --git a/examples/xed-disas-filter.c b/examples/xed-disas-filter.c index 8004f9a8..3393182c 100644 --- a/examples/xed-disas-filter.c +++ b/examples/xed-disas-filter.c @@ -20,6 +20,7 @@ END_LEGAL */ #include #include #include +#include #include #include "xed-examples-util.h" @@ -30,17 +31,17 @@ END_LEGAL */ #define IMAX 32 #define LINELEN 1024 -static int len_hex(char *s) +static int len_hex(char const* s) { - char *p = s; + char const *p = s; while (isxdigit(*p)) p++; return (int)(p - s); } -static unsigned long get_ip(char *line) +static unsigned long get_ip(char const* line) { - char *num; + char const* num; for (num = line; *num; num++) { int l; if (isxdigit(*num) && (l = len_hex(num)) >= 8 && isspace(num[l])) { @@ -67,39 +68,41 @@ xed_uint_t disas_filter(xed_decoded_inst_t *inst, char *prefix, xed_disas_info_t di->symfn = get_symbol; xed_register_disassembly_callback(xed_disassembly_callback_function); while (fgets(line, LINELEN, stdin)) { - xed_error_enum_t err; - char *insn = strstr(line, prefix), *ip; - xed_uint_t ilen; - char out[256]; - unsigned long val; - char *endp; - xed_uint8_t insnbuf[IMAX]; - - if (!insn) { - fputs(line, stdout); - continue; - } - - ip = insn + strlen(prefix); - ilen = 0; - do { - val = strtoul(ip, &endp, 16); - if (insn == endp) - break; - insnbuf[ilen++] = (xed_uint8_t)val; - ip = endp; - } while (ilen < IMAX); - xed_state_t state; - xed_state_zero(&state); - xed_state_set_machine_mode(&state, di->dstate.mmode); - xed_decoded_inst_zero_set_mode(inst, &state); - if ((err = xed_decode(inst, insnbuf, ilen)) != XED_ERROR_NONE) { - snprintf(out, sizeof out, "%s" , xed_error_enum_t2str(err)); - } else { - disassemble(di, out, sizeof out, inst, get_ip(line), - nm_symtab_init ? &nm_symtab : NULL); - } - printf("%.*s\t\t%s%s", (int)(insn - line), line, out, endp); + xed_error_enum_t err; + char *insn = strstr(line, prefix), *ip; + xed_uint_t ilen; + char out[256] = { 0 }; + unsigned long val; + char *endp; + xed_uint8_t insnbuf[IMAX]; + + if (!insn) { + fputs(line, stdout); + continue; + } + + ip = insn + strlen(prefix); + ilen = 0; + do { + val = strtoul(ip, &endp, 16); + if (insn == endp) + break; + insnbuf[ilen++] = (xed_uint8_t)val; + ip = endp; + } while (ilen < IMAX); + xed_state_t state; + xed_state_zero(&state); + xed_state_set_machine_mode(&state, di->dstate.mmode); + xed_decoded_inst_zero_set_mode(inst, &state); + if ((err = xed_decode(inst, insnbuf, ilen)) != XED_ERROR_NONE) { + snprintf(out, sizeof out, "%s", xed_error_enum_t2str(err)); + } + else { + unsigned long ip = get_ip(line); + if(ip < ULONG_MAX) + disassemble(di, out, sizeof out, inst, ip, nm_symtab_init? &nm_symtab : NULL); + } + printf("%.*s\t\t%s%s", (int)(insn - line), line, out, endp); } return 0; } diff --git a/examples/xed-disas-hex.c b/examples/xed-disas-hex.c index df03d08e..6534c06b 100644 --- a/examples/xed-disas-hex.c +++ b/examples/xed-disas-hex.c @@ -69,6 +69,11 @@ xed_disas_hex(xed_disas_info_t* fi) xed_uint8_t b = 0; FILE* f = 0; + if ((fi->input_file_name == 0) || (fi->input_file_name[0] == 0)) { + fprintf(stderr, "ERROR: illegal input_file_name\n"); + exit(1); + } + // read file once to get length f = open_file(fi->input_file_name, "r"); while (read_byte(f,0) != -1) diff --git a/examples/xed-disas-pecoff.cpp b/examples/xed-disas-pecoff.cpp index c03386f7..77e01ed9 100644 --- a/examples/xed-disas-pecoff.cpp +++ b/examples/xed-disas-pecoff.cpp @@ -135,9 +135,11 @@ class pecoff_reader_t { file_handle_ = INVALID_HANDLE_VALUE; map_handle_ = INVALID_HANDLE_VALUE; + base_ = 0; okay_ = false; sixty_four_bit_ = false; + ifh=0; hdr=0; orig_hdr=0; nsections=0; diff --git a/examples/xed-enc-lang.c b/examples/xed-enc-lang.c index 6a7373e4..8cb57bfc 100644 --- a/examples/xed-enc-lang.c +++ b/examples/xed-enc-lang.c @@ -46,14 +46,16 @@ void slash_split(char const* const src, xed_str_list_t* sv = tokenize(src, "/"); xed_str_list_t* p = sv; xed_uint_t i=0; + *first = 0; + *second = 0; for(; p ; i++, p=p->next) { if (i==0) { *first = p->s; - *second = 0; } - else if (i==1) + else if (i==1) { *second = p->s; + } } } @@ -210,12 +212,14 @@ static void mem_bis_parser_init(mem_bis_parser_t* self, char* s) self->base = "INVALID"; self->indx = "INVALID"; self->scale = "1"; + self->disp = ""; self->segment_reg = XED_REG_INVALID; self->base_reg = XED_REG_INVALID; self->index_reg = XED_REG_INVALID; self->disp_val = 0; self->disp_width_bits = 0; self->mem_len = 0; + self->scale_val = 1; upcase(s); // split on colon first @@ -376,7 +380,8 @@ parse_encode_request(ascii_encode_request_t areq) for ( ; p ; token_index++, p=p->next ) { slash_split(p->s, &cfirst, &csecond); - assert(cfirst); + if(cfirst == 0) + break; upcase(cfirst); if (CLIENT_VERBOSE3) printf( "[%s][%s][%s]\n", p->s, @@ -434,6 +439,9 @@ parse_encode_request(ascii_encode_request_t areq) char* cres_reg=0; char* csecond_x=0; //FIXME: not used slash_split(p->s, &cres_reg, &csecond_x); + if (cres_reg == 0) + continue; + upcase(cres_reg); // prune the AGEN or MEM(base,index,scale[,displacement]) text from // cres_reg @@ -443,7 +451,6 @@ parse_encode_request(ascii_encode_request_t areq) if (mem_bis.valid) { xed_reg_class_enum_t rc = XED_REG_CLASS_INVALID; xed_reg_class_enum_t rci = XED_REG_CLASS_INVALID; - if (mem_bis.mem) { if (memop == 0) { diff --git a/examples/xed-ex1.c b/examples/xed-ex1.c index 3f41e11c..7cdc35fe 100644 --- a/examples/xed-ex1.c +++ b/examples/xed-ex1.c @@ -72,9 +72,12 @@ void print_misc(xed_decoded_inst_t* xedd) { if (xed_decoded_inst_is_broadcast(xedd)) printf("BROADCAST\n"); - if ( xed_classify_sse(xedd) || xed_classify_avx(xedd) || xed_classify_avx512(xedd) ) + if (xed_classify_sse(xedd) || xed_classify_avx(xedd) || xed_classify_avx512(xedd) || + xed_classify_amx(xedd)) { - if (xed_classify_avx512_maskop(xedd)) + if (xed_classify_amx(xedd)) + printf("AMX\n"); + else if (xed_classify_avx512_maskop(xedd)) printf("AVX512 KMASK-OP\n"); else { xed_bool_t sse = 0; diff --git a/examples/xed-examples-util.c b/examples/xed-examples-util.c index 9d03b9d7..81df0527 100644 --- a/examples/xed-examples-util.c +++ b/examples/xed-examples-util.c @@ -497,8 +497,9 @@ xed_map_region(const char* path, MAP_PRIVATE, fd, 0); - if (*start == (void*) -1) + if (*start == MAP_FAILED) xedex_derror("could not map region"); + close(fd); #endif if (CLIENT_VERBOSE1) printf("Mapped " XED_FMT_U " bytes!\n", *length); @@ -1364,6 +1365,7 @@ void xed_disas_test(xed_disas_info_t* di) if (graph_empty ==0 ) xed_dot_graph_dump(di->dot_graph_output, gs); xed_dot_graph_supp_deallocate(gs); + free(gs); } di->errors += errors; diff --git a/examples/xed-find-special.c b/examples/xed-find-special.c index 77cc6cd0..8a2096fc 100644 --- a/examples/xed-find-special.c +++ b/examples/xed-find-special.c @@ -62,8 +62,12 @@ static void scan_inst(const xed_inst_t* p) { } if (xed_inst_get_attribute(p,XED_ATTRIBUTE_REP)) { char const* ics = xed_iclass_enum_t2str(ic); + char const* suf = suffix_name(ics); reptype_enum_t rt = get_reptype(ics); - printf("REP* %s --> %s + %s\n", ics, reptype_enum_t2str(rt), suffix_name(ics)); + if (suf) + printf("REP* %s --> %s + %s\n", ics, reptype_enum_t2str(rt), suf); + else + printf("REP* %s --> %s\n", ics, reptype_enum_t2str(rt)); } if (cat == XED_CATEGORY_STRINGOP || cat == XED_CATEGORY_IOSTRINGOP) { char const* ics = xed_iclass_enum_t2str(ic); diff --git a/examples/xed.c b/examples/xed.c index 0122b4c7..0e384720 100644 --- a/examples/xed.c +++ b/examples/xed.c @@ -1,6 +1,6 @@ /*BEGIN_LEGAL -Copyright (c) 2019 Intel Corporation +Copyright (c) 2019-2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -85,6 +85,8 @@ fopen_portable(char const* const file_name, char const* const mode) { FILE* f = 0; + if ((file_name == 0) || (file_name[0] == 0)) + return 0; #if defined(XED_WINDOWS) && !defined(PIN_CRT) errno_t error = fopen_s(&f, file_name, mode); if (error != 0) @@ -161,7 +163,12 @@ static void xed_assemble(const xed_state_t* dstate, #define ASM_BUF_SIZE 1024 const xed_int_t bsize = ASM_BUF_SIZE; char buf[ASM_BUF_SIZE]; - FILE* f = fopen_portable(encode_file_name,"r"); + FILE* f; + if ((encode_file_name == 0) || (encode_file_name[0] == 0)) { + printf("illegal 'encode_file_name' file name\n"); + xedex_derror("Dying"); + } + f = fopen_portable(encode_file_name, "r"); if (!f) { printf("Could not open %s\n", encode_file_name); xedex_derror("Dying"); @@ -732,7 +739,7 @@ main(int argc, char** argv) } #if defined(XED_LINUX) - if (nm_symtab_fn) { + if ((nm_symtab_fn != 0) && (nm_symtab_fn[0] != 0)) { if (!filter) { printf("ERROR: -S only support with -F for now\n"); exit(1); @@ -791,6 +798,7 @@ main(int argc, char** argv) decode_info.operand = operand; decode_info.operand_value = operand_value; decode_info.encode_force = encode_force; + decode_info.dot_graph_output = 0; if (dot) { @@ -917,6 +925,14 @@ main(int argc, char** argv) if (retval_okay==0) exit(1); + if (decode_info.dot_graph_output) + fclose(decode_info.dot_graph_output); + if (decode_text) + free((void*)decode_text); +#if defined(XED_ENCODER) + if (encode_text) + free((void*)encode_text); +#endif return 0; (void) obytes; (void) encode_text; diff --git a/include/public/xed/xed-decoded-inst-api.h b/include/public/xed/xed-decoded-inst-api.h index 7bf158a4..51d3317a 100644 --- a/include/public/xed/xed-decoded-inst-api.h +++ b/include/public/xed/xed-decoded-inst-api.h @@ -678,6 +678,9 @@ xed_decoded_inst_set_user_data(xed_decoded_inst_t* p, /// @name xed_decoded_inst_t Classifiers //@{ /// @ingroup DEC +/// True for AMX instructions +XED_DLL_EXPORT xed_bool_t +xed_classify_amx(const xed_decoded_inst_t* d); /// True for AVX512 (EVEX-encoded) SIMD and (VEX encoded) K-mask instructions XED_DLL_EXPORT xed_bool_t xed_classify_avx512(const xed_decoded_inst_t* d); diff --git a/include/public/xed/xed-version.h b/include/public/xed/xed-version.h index eba214f2..9b298809 100644 --- a/include/public/xed/xed-version.h +++ b/include/public/xed/xed-version.h @@ -1,6 +1,6 @@ /*BEGIN_LEGAL -Copyright (c) 2019 Intel Corporation +Copyright (c) 2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/mfile.py b/mfile.py index 5076cee8..c33a2152 100755 --- a/mfile.py +++ b/mfile.py @@ -75,7 +75,7 @@ def find_mbuild_import(): # (enumer,codegen) can find mbuild. if 'PYTHONPATH' in os.environ: - sep = ':' + sep = os.pathsep os.environ['PYTHONPATH'] = mbuild_install_path + sep + \ os.environ['PYTHONPATH'] else: @@ -96,13 +96,10 @@ def work(): fatal("mbuild import failed") import xed_mbuild import xed_build_common - if 0: + try: retval = xed_mbuild.execute() - else: - try: - retval = xed_mbuild.execute() - except Exception as e: - xed_build_common.handle_exception_and_die(e) + except Exception as e: + xed_build_common.handle_exception_and_die(e) return retval if __name__ == "__main__": diff --git a/pysrc/classifier.py b/pysrc/classifier.py index 07e2537b..ca9a3f89 100644 --- a/pysrc/classifier.py +++ b/pysrc/classifier.py @@ -47,10 +47,13 @@ def work(agi): avx_isa_sets = set([]) avx512_isa_sets = set([]) avx512_kmask_op = set([]) + amx_isa_sets = set([]) for generator in agi.generator_list: for ii in generator.parser_output.instructions: if genutil.field_check(ii, 'iclass'): - if re.search('AVX512',ii.isa_set): + if re.search('AMX',ii.isa_set): + amx_isa_sets.add(ii.isa_set) + elif re.search('AVX512',ii.isa_set): avx512_isa_sets.add(ii.isa_set) if re.search('KOP',ii.isa_set): avx512_kmask_op.add(ii.isa_set) @@ -69,6 +72,7 @@ def work(agi): sse_isa_sets.add(ii.isa_set) fe = agi.open_file('xed-classifiers.c') # xed_file_emitter_t + _emit_function(fe, amx_isa_sets, 'amx') _emit_function(fe, avx512_isa_sets, 'avx512') _emit_function(fe, avx512_kmask_op, 'avx512_maskop') _emit_function(fe, avx_isa_sets, 'avx') diff --git a/pysrc/codegen.py b/pysrc/codegen.py index ee567f5e..548d43eb 100644 --- a/pysrc/codegen.py +++ b/pysrc/codegen.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- python -*- -# Mark Charney # Code generation support: emitting files, emitting functions, etc. #BEGIN_LEGAL # diff --git a/pysrc/enc2gen.py b/pysrc/enc2gen.py index c2ef2e96..74f3cedf 100755 --- a/pysrc/enc2gen.py +++ b/pysrc/enc2gen.py @@ -3885,7 +3885,8 @@ def create_vex_simd_reg(env,ii): elif ii.rm_required != 'unspecified': if ii.rm_required: # ZERO INIT OPTIMIZATION fo.add_code_eol('set_rm(r,{})'.format(ii.rm_required)) - + + # NOTE - for any SE_IMM related issues, look at create_vex_regs_mem() if var_se: fo.add_code_eol('enc_imm8_reg_{}(r,{})'.format(sz_se, var_se)) @@ -3919,16 +3920,18 @@ def create_vex_regs_mem(env,ii): width = op.oc2 opsig = make_opnd_signature(env,ii) vlname = 'ymm' if ii.vl == '256' else 'xmm' - immw=0 - if ii.has_imm8: - immw=8 dispsz_list = get_dispsz_list(env) opnd_types_org = get_opnd_types(env,ii) arg_regs = [ arg_reg0, arg_reg1, arg_reg2, arg_reg3 ] var_regs = [ var_reg0, var_reg1, var_reg2, var_reg3 ] ispace = itertools.product(get_index_vals(ii), dispsz_list) - for use_index, dispsz in ispace: + for use_index, dispsz in ispace: + # each enc function might need its own imm width for emitting reg in SE_IMM + immw = 0 + if ii.has_imm8: + immw = 8 + memaddrsig = get_memsig(env.asz, use_index, dispsz) fname = "{}_{}_{}_{}".format(enc_fn_prefix, diff --git a/pysrc/enum_txt_writer.py b/pysrc/enum_txt_writer.py index 9736b3cc..2b411e63 100755 --- a/pysrc/enum_txt_writer.py +++ b/pysrc/enum_txt_writer.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- python -*- -# Mark Charney # Enumeration support #BEGIN_LEGAL # diff --git a/pysrc/enumer.py b/pysrc/enumer.py index ffafc850..5009d53d 100755 --- a/pysrc/enumer.py +++ b/pysrc/enumer.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- python -*- -# Mark Charney #BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation diff --git a/pysrc/gen-enum.py b/pysrc/gen-enum.py index b88a4a27..d0aee0d3 100644 --- a/pysrc/gen-enum.py +++ b/pysrc/gen-enum.py @@ -3,7 +3,6 @@ ######################################################## # THIS IS NOT DONE YET... IGNORE FOR NOW ######################################################## -# Mark Charney #BEGIN_LEGAL # #Copyright (c) 2019 Intel Corporation diff --git a/pysrc/genutil.py b/pysrc/genutil.py index 0ff62882..34840d6f 100755 --- a/pysrc/genutil.py +++ b/pysrc/genutil.py @@ -1,5 +1,4 @@ #-*- python -*- -# Mark Charney # Generic utilities #BEGIN_LEGAL # diff --git a/pysrc/ildutil.py b/pysrc/ildutil.py index 7370f663..1a4953b5 100644 --- a/pysrc/ildutil.py +++ b/pysrc/ildutil.py @@ -1,5 +1,4 @@ #-*- python -*- -# Mark Charney # Generic utilities #BEGIN_LEGAL # diff --git a/pysrc/metaenum.py b/pysrc/metaenum.py index 04a8bab4..a8603cf6 100755 --- a/pysrc/metaenum.py +++ b/pysrc/metaenum.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- python -*- -# Mark Charney # Enumeration support #BEGIN_LEGAL # diff --git a/pysrc/slash_expand.py b/pysrc/slash_expand.py index 0388a5a3..896a40ee 100755 --- a/pysrc/slash_expand.py +++ b/pysrc/slash_expand.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- python -*- -# Mark Charney # Code generation support: emitting files, emitting functions, etc. #BEGIN_LEGAL # diff --git a/src/common/xed-version.c b/src/common/xed-version.c index 99cd2f85..b3791aa5 100644 --- a/src/common/xed-version.c +++ b/src/common/xed-version.c @@ -1,6 +1,6 @@ /*BEGIN_LEGAL -Copyright (c) 2021 Intel Corporation +Copyright (c) 2022 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,12 +19,12 @@ END_LEGAL */ #include "xed-version.h" char const* const xed_copyright = - "Copyright (C) 2021, Intel Corporation. All rights reserved."; + "Copyright (C) 2022, Intel Corporation. All rights reserved."; /* need two levels of macros to expand and stringify the CPP macro arg. */ #define XED_STR1(x) #x #define XED_STR2(a) XED_STR1(a) -char const* const xed_version = XED_STR2(XED_GIT_VERSION) ; +char const* const xed_version = XED_STR2(XED_VERSION) ; char const* xed_get_version(void) { return xed_version; diff --git a/src/dec/xed-decoded-inst.c b/src/dec/xed-decoded-inst.c index 48ee75d2..83cec222 100644 --- a/src/dec/xed-decoded-inst.c +++ b/src/dec/xed-decoded-inst.c @@ -936,6 +936,8 @@ xed_uint_t xed_decoded_inst_avx512_dest_elements(const xed_decoded_inst_t* p) { if (dest_element_bits) return vl_dest_bits / dest_element_bits; } +#else + (void)p; // satisfy compiler #endif return 0; } diff --git a/src/dec/xed-ild.c b/src/dec/xed-ild.c index 6c5031d3..ff0b3962 100644 --- a/src/dec/xed-ild.c +++ b/src/dec/xed-ild.c @@ -1044,7 +1044,7 @@ static void opcode_scanner(xed_decoded_inst_t* d) { unsigned char length = xed_decoded_inst_get_length(d); xed_uint8_t b = xed_decoded_inst_get_byte(d, length); - xed_int_t i; + xed_uint64_t i; // matching maps vs having a summary of which opcodes are definately map0. // Common case is map 0, but the loop would check them all and deduce map 0, slowly. @@ -1168,6 +1168,8 @@ typedef union{ // AVX512 only static XED_INLINE xed_bool_t chip_supports_avx512(xed_decoded_inst_t* d) { xed_chip_enum_t chip = xed_decoded_inst_get_input_chip(d); + if (xed3_operand_get_no_vex(d) || xed3_operand_get_no_evex(d)) + return 0; if (chip == XED_CHIP_INVALID) chip = XED_CHIP_ALL; if (chip < XED_CHIP_LAST) @@ -1310,6 +1312,11 @@ static void evex_scanner(xed_decoded_inst_t* d) * one byte as nominal opcode, this is exactly what we want for * evex*/ evex_vex_opcode_scanner(d); + + /* identify the instruction as EVEX (will be used in the encoder to force + * re-encoding in the EVEX space). + * This will prevent cases where EVEX input will be re-encoded to VEX space */ + xed3_operand_set_must_use_evex(d, 1); } else { /*there is no enough bytes, hence we are out of bytes */ @@ -1455,21 +1462,31 @@ xed_instruction_length_decode(xed_decoded_inst_t* ild) { prefix_scanner(ild); #if defined(XED_AVX) - if (xed3_operand_get_out_of_bytes(ild)) + if (xed3_operand_get_out_of_bytes(ild)) return; - vex_scanner(ild); + if (!xed3_operand_get_no_vex(ild)) + vex_scanner(ild); #endif #if defined(XED_SUPPORTS_AVX512) || defined(XED_SUPPORTS_KNC) // evex scanner assumes it can read bytes so we must check for limit first. if (xed3_operand_get_out_of_bytes(ild) || - xed3_operand_get_error(ild) ) + xed3_operand_get_error(ild)) return; // if we got a vex prefix (which also sucks down the opcode), // then we do not need to scan for evex prefixes. - if (!xed3_operand_get_vexvalid(ild) && chip_supports_avx512(ild)) + if (!xed3_operand_get_vexvalid(ild)) { +#if defined(XED_SUPPORTS_KNC) + // Always scan for EVEX prefixes (No AVX512 in KNC build) evex_scanner(ild); +#else + if (chip_supports_avx512(ild)) { + // Scan EVEX prefixes only if chip supports AVX512 + evex_scanner(ild); + } +#endif + } #endif if (xed3_operand_get_out_of_bytes(ild)) @@ -1481,7 +1498,7 @@ xed_instruction_length_decode(xed_decoded_inst_t* ild) #if defined(XED_AVX) // vex/xop prefixes also eat the vex/xop opcode if (!xed3_operand_get_vexvalid(ild) && - !xed3_operand_get_error(ild) ) + !xed3_operand_get_error(ild)) opcode_scanner(ild); #else opcode_scanner(ild); diff --git a/tests/REBASE.TESTS b/tests/REBASE.TESTS index df0090d9..e2c4113c 100755 --- a/tests/REBASE.TESTS +++ b/tests/REBASE.TESTS @@ -1,2 +1,2 @@ -./run-cmd.py --build-dir ../obj/wkit/bin --rebase-tests --tests tests-base --tests tests-avx512 --tests tests-xop --tests test-avx512pf --tests tests-cet --tests tests-via --tests tests-syntax +./run-cmd.py --build-dir ../obj/wkit/bin --rebase-tests --tests tests-base --tests tests-avx512 --tests tests-xop --tests test-avx512pf --tests tests-cet --tests tests-via --tests tests-syntax --tests tests-amx ./run-cmd.py --build-dir ../obj-knc/wkit/bin --rebase-tests --tests tests-knc diff --git a/tests/RECREATE.TESTS b/tests/RECREATE.TESTS index f71a5f2c..e2d7ce6b 100755 --- a/tests/RECREATE.TESTS +++ b/tests/RECREATE.TESTS @@ -3,6 +3,8 @@ ./run-cmd.py --build-dir ../obj/wkit/bin --otests tests-avx512 -b bulk-tests/avx512x-bulk-tests.txt ./run-cmd.py --build-dir ../obj/wkit/bin --otests tests-avx512pf -b bulk-tests/avx512pf-bulk-tests.txt +./run-cmd.py --build-dir ../obj/wkit/bin --otests tests-amx -b bulk-tests/amx-bulk-tests.txt + ./run-cmd.py --build-dir ../obj-knc/wkit/bin --otests tests-knc -b bulk-tests/knc-bulk-tests.txt ./run-cmd.py --build-dir ../obj/wkit/bin --otests tests-xop -b bulk-tests/amd-xop-bulk-tests.txt diff --git a/tests/RUN.TESTS b/tests/RUN.TESTS index c4dc9653..8084fff2 100755 --- a/tests/RUN.TESTS +++ b/tests/RUN.TESTS @@ -1,2 +1,2 @@ -./run-cmd.py --build-dir ../obj/wkit/bin --tests tests-base --tests tests-avx512 --tests tests-avx512pf --tests tests-cet --tests tests-via +./run-cmd.py --build-dir ../obj/wkit/bin --tests tests-base --tests tests-avx512 --tests tests-avx512pf --tests tests-cet --tests tests-via --tests tests-amx ./run-cmd.py --build-dir ../obj-knc/wkit/bin --tests tests-base --tests tests-knc diff --git a/tests/bulk-tests/amx-bulk-tests.txt b/tests/bulk-tests/amx-bulk-tests.txt new file mode 100644 index 00000000..83b0fa9b --- /dev/null +++ b/tests/bulk-tests/amx-bulk-tests.txt @@ -0,0 +1,10 @@ +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e27b49c0 # TILEZERO +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e2784900 # LDTILECFG +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e27b4b0410 # TILELOADD +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e27a4b0410 # TILESTORED +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e27b5ed1 # TDPBSSD +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e27a5ed1 # TDPBSUD +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e2795ed1 # TDPBUSD +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e2785ed1 # TDPBUUD +DEC ENC AMX ; BUILDDIR/xed -64 -de c4e2725cd0 # TDPBF16PS +DEC AMX ; BUILDDIR/xed-ex1 -64 c4e2725cd0 \ No newline at end of file diff --git a/tests/bulk-tests/avx512x-bulk-tests.txt b/tests/bulk-tests/avx512x-bulk-tests.txt index 58b37470..5ddbe0c1 100644 --- a/tests/bulk-tests/avx512x-bulk-tests.txt +++ b/tests/bulk-tests/avx512x-bulk-tests.txt @@ -23,3 +23,6 @@ DEC AVX512X ; BUILDDIR/xed -64 -d 62 C1 DF 68 58 E5 DEC AVX512X ; BUILDDIR/xed -d f3 67 2e f0 f3 f3 65 67 62 f1 5d 8e d0 8e e7 DEC AVX512X ; BUILDDIR/xed -64 -d 62 61 fa 48 7a f7 DEC ENC AVX512X ; BUILDDIR/xed -de 62 f1 7e 08 2c 55 04 +DEC ENC AVX512X ; BUILDDIR/xed -32 -de 62 f5 7e 08 79 c0 +DEC AVX512X ; BUILDDIR/xed -set NO_VEX 1 -d C4E1FB93D8 +DEC AVX512X ; BUILDDIR/xed -set NO_EVEX 1 -d 62 F2 7D 48 13 C0 \ No newline at end of file diff --git a/tests/bulk-tests/bulk-tests.txt b/tests/bulk-tests/bulk-tests.txt index 435f506b..24001037 100644 --- a/tests/bulk-tests/bulk-tests.txt +++ b/tests/bulk-tests/bulk-tests.txt @@ -303,9 +303,9 @@ DEC ENC AVX ; BUILDDIR/xed -64 -de C4E2E9910408 DEC ENC AVX ; BUILDDIR/xed -64 -de C4E2ED910408 DEC XOP ; BUILDDIR/xed-ex-ild2 -64 8f e9 78 81 ca DEC XOP ; BUILDDIR/xed-ex-ild2 -64 -chip WESTMERE 8f e9 78 81 ca -DEC ENC ; BUILDDIR/xed -64 -de 0f1aff -DEC ENC ; BUILDDIR/xed -64 -de 0f1bff -DEC ENC ; BUILDDIR/xed -64 -de f30f1bff +DEC ; BUILDDIR/xed -64 -d 0f1aff +DEC ; BUILDDIR/xed -64 -d 0f1bff +DEC ; BUILDDIR/xed -64 -d f30f1bff DEC AVX AMD ; BUILDDIR/xed -32 -d c4 c3 bd 79 f2 45 DEC AVX AMD ; BUILDDIR/xed -64 -d c4 c3 bd 79 f2 45 DEC AVX AMD ; BUILDDIR/xed -32 -d c4 c3 b9 79 f2 45 diff --git a/tests/bulk-tests/new-tests.txt b/tests/bulk-tests/new-tests.txt index ac0f151d..0d89c5de 100644 --- a/tests/bulk-tests/new-tests.txt +++ b/tests/bulk-tests/new-tests.txt @@ -45,9 +45,9 @@ DEC ENC ; BUILDDIR/xed -de 62 00 DEC ENC ; BUILDDIR/xed -de 66 62 00 # tag these tests with AVX512X because the chips mentioned currently # only come with AVX512 configurations -DEC ; BUILDDIR/xed -chip-check SKYLAKE_SERVER -d 66 0fae 30 -DEC ; BUILDDIR/xed -chip-check CANNONLAKE -d 66 0fae 30 -DEC ; BUILDDIR/xed -chip-check ICE_LAKE_SERVER -d 66 0fae 30 +DEC AVX512X ; BUILDDIR/xed -chip-check SKYLAKE_SERVER -d 66 0fae 30 +DEC AVX512X ; BUILDDIR/xed -chip-check CANNONLAKE -d 66 0fae 30 +DEC AVX512X ; BUILDDIR/xed -chip-check ICE_LAKE_SERVER -d 66 0fae 30 DEC ; BUILDDIR/xed -d 0f1c00 DEC ; BUILDDIR/xed -set CLDEMOTE 1 -d 0f1c00 DEC ; BUILDDIR/xed -chip-check SNOW_RIDGE -d 0f1c00 diff --git a/tests/run-cmd.py b/tests/run-cmd.py index b02d4725..ab74b6dd 100755 --- a/tests/run-cmd.py +++ b/tests/run-cmd.py @@ -51,11 +51,9 @@ def find_dir(d): def write_file(fn,lines): print("[EMIT] %s" % (fn)) - # write the file in binary mode to prevent LF -> CR LF expansion on Windows - f = open(fn,"wb") - if lines: - for line in lines: - f.write(line.replace('\r', '')) # gobble CR symbols if any + f = open(fn, 'w') + for line in lines: + f.write(line) f.close() @@ -73,7 +71,7 @@ def create_reference(env, test_dir, codes_and_cmd, make_new=True): # abspath required for windoze build_dir = mbuild.posix_slashes(os.path.abspath(env['build_dir'])) - cmd2 = re.sub('BUILDDIR',build_dir,cmd) + cmd2 = re.sub('BUILDDIR',build_dir,cmd).strip() print(cmd2) (retcode, stdout,stderr) = mbuild.run_command(cmd2,separate_stderr=True) diff --git a/tests/tests-amx/test-00000/cmd b/tests/tests-amx/test-00000/cmd new file mode 100644 index 00000000..991fd333 --- /dev/null +++ b/tests/tests-amx/test-00000/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e27b49c0 diff --git a/tests/tests-amx/test-00000/codes b/tests/tests-amx/test-00000/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00000/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00000/retcode.reference b/tests/tests-amx/test-00000/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00000/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00000/stderr.reference b/tests/tests-amx/test-00000/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00000/stdout.reference b/tests/tests-amx/test-00000/stdout.reference new file mode 100644 index 00000000..14fd9584 --- /dev/null +++ b/tests/tests-amx/test-00000/stdout.reference @@ -0,0 +1,10 @@ +C4E27B49C0 +ICLASS: TILEZERO +CATEGORY: AMX_TILE +EXTENSION: AMX_TILE +IFORM: TILEZERO_TMMu32 +ISA_SET: AMX_TILE +ATTRIBUTES: NOTSX +SHORT: tilezero tmm0 +Encodable! C4E27B49C0 +Identical re-encoding diff --git a/tests/tests-amx/test-00001/cmd b/tests/tests-amx/test-00001/cmd new file mode 100644 index 00000000..1625748a --- /dev/null +++ b/tests/tests-amx/test-00001/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e2784900 diff --git a/tests/tests-amx/test-00001/codes b/tests/tests-amx/test-00001/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00001/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00001/retcode.reference b/tests/tests-amx/test-00001/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00001/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00001/stderr.reference b/tests/tests-amx/test-00001/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00001/stdout.reference b/tests/tests-amx/test-00001/stdout.reference new file mode 100644 index 00000000..5c5e692d --- /dev/null +++ b/tests/tests-amx/test-00001/stdout.reference @@ -0,0 +1,10 @@ +C4E2784900 +ICLASS: LDTILECFG +CATEGORY: AMX_TILE +EXTENSION: AMX_TILE +IFORM: LDTILECFG_MEM +ISA_SET: AMX_TILE +ATTRIBUTES: NOTSX +SHORT: ldtilecfg zmmword ptr [rax] +Encodable! C4E2784900 +Identical re-encoding diff --git a/tests/tests-amx/test-00002/cmd b/tests/tests-amx/test-00002/cmd new file mode 100644 index 00000000..f6d50088 --- /dev/null +++ b/tests/tests-amx/test-00002/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e27b4b0410 diff --git a/tests/tests-amx/test-00002/codes b/tests/tests-amx/test-00002/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00002/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00002/retcode.reference b/tests/tests-amx/test-00002/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00002/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00002/stderr.reference b/tests/tests-amx/test-00002/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00002/stdout.reference b/tests/tests-amx/test-00002/stdout.reference new file mode 100644 index 00000000..431fb521 --- /dev/null +++ b/tests/tests-amx/test-00002/stdout.reference @@ -0,0 +1,10 @@ +C4E27B4B0410 +ICLASS: TILELOADD +CATEGORY: AMX_TILE +EXTENSION: AMX_TILE +IFORM: TILELOADD_TMMu32_MEMu32 +ISA_SET: AMX_TILE +ATTRIBUTES: NOTSX SPECIAL_AGEN_REQUIRED +SHORT: tileloadd tmm0, ptr [rax+rdx*1] +Encodable! C4E27B4B0410 +Identical re-encoding diff --git a/tests/tests-amx/test-00003/cmd b/tests/tests-amx/test-00003/cmd new file mode 100644 index 00000000..9b51397f --- /dev/null +++ b/tests/tests-amx/test-00003/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e27a4b0410 diff --git a/tests/tests-amx/test-00003/codes b/tests/tests-amx/test-00003/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00003/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00003/retcode.reference b/tests/tests-amx/test-00003/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00003/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00003/stderr.reference b/tests/tests-amx/test-00003/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00003/stdout.reference b/tests/tests-amx/test-00003/stdout.reference new file mode 100644 index 00000000..8aa3e62f --- /dev/null +++ b/tests/tests-amx/test-00003/stdout.reference @@ -0,0 +1,10 @@ +C4E27A4B0410 +ICLASS: TILESTORED +CATEGORY: AMX_TILE +EXTENSION: AMX_TILE +IFORM: TILESTORED_MEMu32_TMMu32 +ISA_SET: AMX_TILE +ATTRIBUTES: NOTSX SPECIAL_AGEN_REQUIRED +SHORT: tilestored ptr [rax+rdx*1], tmm0 +Encodable! C4E27A4B0410 +Identical re-encoding diff --git a/tests/tests-amx/test-00004/cmd b/tests/tests-amx/test-00004/cmd new file mode 100644 index 00000000..55a8a193 --- /dev/null +++ b/tests/tests-amx/test-00004/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e27b5ed1 diff --git a/tests/tests-amx/test-00004/codes b/tests/tests-amx/test-00004/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00004/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00004/retcode.reference b/tests/tests-amx/test-00004/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00004/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00004/stderr.reference b/tests/tests-amx/test-00004/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00004/stdout.reference b/tests/tests-amx/test-00004/stdout.reference new file mode 100644 index 00000000..9ec2ec30 --- /dev/null +++ b/tests/tests-amx/test-00004/stdout.reference @@ -0,0 +1,10 @@ +C4E27B5ED1 +ICLASS: TDPBSSD +CATEGORY: AMX_TILE +EXTENSION: AMX_INT8 +IFORM: TDPBSSD_TMMi32_TMMu32_TMMu32 +ISA_SET: AMX_INT8 +ATTRIBUTES: NOTSX +SHORT: tdpbssd tmm2, tmm1, tmm0 +Encodable! C4E27B5ED1 +Identical re-encoding diff --git a/tests/tests-amx/test-00005/cmd b/tests/tests-amx/test-00005/cmd new file mode 100644 index 00000000..9489e0a9 --- /dev/null +++ b/tests/tests-amx/test-00005/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e27a5ed1 diff --git a/tests/tests-amx/test-00005/codes b/tests/tests-amx/test-00005/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00005/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00005/retcode.reference b/tests/tests-amx/test-00005/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00005/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00005/stderr.reference b/tests/tests-amx/test-00005/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00005/stdout.reference b/tests/tests-amx/test-00005/stdout.reference new file mode 100644 index 00000000..8ac4c1a9 --- /dev/null +++ b/tests/tests-amx/test-00005/stdout.reference @@ -0,0 +1,10 @@ +C4E27A5ED1 +ICLASS: TDPBSUD +CATEGORY: AMX_TILE +EXTENSION: AMX_INT8 +IFORM: TDPBSUD_TMMi32_TMMu32_TMMu32 +ISA_SET: AMX_INT8 +ATTRIBUTES: NOTSX +SHORT: tdpbsud tmm2, tmm1, tmm0 +Encodable! C4E27A5ED1 +Identical re-encoding diff --git a/tests/tests-amx/test-00006/cmd b/tests/tests-amx/test-00006/cmd new file mode 100644 index 00000000..0dfef2bd --- /dev/null +++ b/tests/tests-amx/test-00006/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e2795ed1 diff --git a/tests/tests-amx/test-00006/codes b/tests/tests-amx/test-00006/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00006/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00006/retcode.reference b/tests/tests-amx/test-00006/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00006/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00006/stderr.reference b/tests/tests-amx/test-00006/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00006/stdout.reference b/tests/tests-amx/test-00006/stdout.reference new file mode 100644 index 00000000..a8767a91 --- /dev/null +++ b/tests/tests-amx/test-00006/stdout.reference @@ -0,0 +1,10 @@ +C4E2795ED1 +ICLASS: TDPBUSD +CATEGORY: AMX_TILE +EXTENSION: AMX_INT8 +IFORM: TDPBUSD_TMMi32_TMMu32_TMMu32 +ISA_SET: AMX_INT8 +ATTRIBUTES: NOTSX +SHORT: tdpbusd tmm2, tmm1, tmm0 +Encodable! C4E2795ED1 +Identical re-encoding diff --git a/tests/tests-amx/test-00007/cmd b/tests/tests-amx/test-00007/cmd new file mode 100644 index 00000000..e1d5dfaa --- /dev/null +++ b/tests/tests-amx/test-00007/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e2785ed1 diff --git a/tests/tests-amx/test-00007/codes b/tests/tests-amx/test-00007/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00007/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00007/retcode.reference b/tests/tests-amx/test-00007/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00007/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00007/stderr.reference b/tests/tests-amx/test-00007/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00007/stdout.reference b/tests/tests-amx/test-00007/stdout.reference new file mode 100644 index 00000000..81b02c07 --- /dev/null +++ b/tests/tests-amx/test-00007/stdout.reference @@ -0,0 +1,10 @@ +C4E2785ED1 +ICLASS: TDPBUUD +CATEGORY: AMX_TILE +EXTENSION: AMX_INT8 +IFORM: TDPBUUD_TMMu32_TMMu32_TMMu32 +ISA_SET: AMX_INT8 +ATTRIBUTES: NOTSX +SHORT: tdpbuud tmm2, tmm1, tmm0 +Encodable! C4E2785ED1 +Identical re-encoding diff --git a/tests/tests-amx/test-00008/cmd b/tests/tests-amx/test-00008/cmd new file mode 100644 index 00000000..7bbad4ad --- /dev/null +++ b/tests/tests-amx/test-00008/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -64 -de c4e2725cd0 diff --git a/tests/tests-amx/test-00008/codes b/tests/tests-amx/test-00008/codes new file mode 100644 index 00000000..9082be71 --- /dev/null +++ b/tests/tests-amx/test-00008/codes @@ -0,0 +1 @@ +DEC ENC AMX diff --git a/tests/tests-amx/test-00008/retcode.reference b/tests/tests-amx/test-00008/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00008/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00008/stderr.reference b/tests/tests-amx/test-00008/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00008/stdout.reference b/tests/tests-amx/test-00008/stdout.reference new file mode 100644 index 00000000..ba6b124f --- /dev/null +++ b/tests/tests-amx/test-00008/stdout.reference @@ -0,0 +1,10 @@ +C4E2725CD0 +ICLASS: TDPBF16PS +CATEGORY: AMX_TILE +EXTENSION: AMX_BF16 +IFORM: TDPBF16PS_TMMf32_TMMu32_TMMu32 +ISA_SET: AMX_BF16 +ATTRIBUTES: NOTSX +SHORT: tdpbf16ps tmm2, tmm0, tmm1 +Encodable! C4E2725CD0 +Identical re-encoding diff --git a/tests/tests-amx/test-00009/cmd b/tests/tests-amx/test-00009/cmd new file mode 100644 index 00000000..b8ea9ced --- /dev/null +++ b/tests/tests-amx/test-00009/cmd @@ -0,0 +1 @@ + BUILDDIR/xed-ex1 -64 c4e2725cd0 diff --git a/tests/tests-amx/test-00009/codes b/tests/tests-amx/test-00009/codes new file mode 100644 index 00000000..2ab10152 --- /dev/null +++ b/tests/tests-amx/test-00009/codes @@ -0,0 +1 @@ +DEC AMX diff --git a/tests/tests-amx/test-00009/retcode.reference b/tests/tests-amx/test-00009/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-amx/test-00009/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-amx/test-00009/stderr.reference b/tests/tests-amx/test-00009/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-amx/test-00009/stdout.reference b/tests/tests-amx/test-00009/stdout.reference new file mode 100644 index 00000000..f66c850e --- /dev/null +++ b/tests/tests-amx/test-00009/stdout.reference @@ -0,0 +1,28 @@ +Attempting to decode: c4 e2 72 5c d0 +iclass TDPBF16PS category AMX_TILE ISA-extension AMX_BF16 ISA-set AMX_BF16 +instruction-length 5 +operand-width 32 +effective-operand-width 32 +effective-address-width 64 +stack-address-width 64 +iform-enum-name TDPBF16PS_TMMf32_TMMu32_TMMu32 +iform-enum-name-dispatch (zero based) 0 +iclass-max-iform-dispatch 1 +Nominal opcode position 3 +Nominal opcode 0x5c +Operands +# TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS +# ==== ======= === == === ==== ===== ===== ====== ======== ======== +0 REG0 REG0=TMM2 EXPLICIT RW TV 0 0 0 32 SINGLE TREG +1 REG1 REG1=TMM0 EXPLICIT R TV 0 0 0 32 UINT TREG +2 REG2 REG2=TMM1 EXPLICIT R TV 0 0 0 32 UINT TREG +Memory Operands + MemopBytes = 0 +ATTRIBUTES: NOTSX +EXCEPTION TYPE: AMX_E4 +AMX +ISA SET: [AMX_BF16] +0 CPUID BIT NAME: [AMX_TILES] + Leaf 0x00000007, subleaf 0x00000000, EDX[24] +1 CPUID BIT NAME: [AMX_BF16] + Leaf 0x00000007, subleaf 0x00000000, EDX[22] diff --git a/tests/tests-avx512/test-00025/cmd b/tests/tests-avx512/test-00025/cmd new file mode 100644 index 00000000..f1be61bd --- /dev/null +++ b/tests/tests-avx512/test-00025/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -32 -de 62 f5 7e 08 79 c0 diff --git a/tests/tests-avx512/test-00025/codes b/tests/tests-avx512/test-00025/codes new file mode 100644 index 00000000..d68a82a9 --- /dev/null +++ b/tests/tests-avx512/test-00025/codes @@ -0,0 +1 @@ +DEC ENC AVX512X diff --git a/tests/tests-avx512/test-00025/retcode.reference b/tests/tests-avx512/test-00025/retcode.reference new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/tests-avx512/test-00025/retcode.reference @@ -0,0 +1 @@ +0 diff --git a/tests/tests-avx512/test-00025/stderr.reference b/tests/tests-avx512/test-00025/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-avx512/test-00025/stdout.reference b/tests/tests-avx512/test-00025/stdout.reference new file mode 100644 index 00000000..318a6675 --- /dev/null +++ b/tests/tests-avx512/test-00025/stdout.reference @@ -0,0 +1,10 @@ +62F57E0879C0 +ICLASS: VCVTSH2USI +CATEGORY: CONVERT +EXTENSION: AVX512EVEX +IFORM: VCVTSH2USI_GPR32u32_XMMf16_AVX512 +ISA_SET: AVX512_FP16_SCALAR +ATTRIBUTES: MXCSR SIMD_SCALAR +SHORT: vcvtsh2usi eax, xmm0 +Encodable! 62F57E0879C0 +Identical re-encoding diff --git a/tests/tests-avx512/test-00026/cmd b/tests/tests-avx512/test-00026/cmd new file mode 100644 index 00000000..e09f874b --- /dev/null +++ b/tests/tests-avx512/test-00026/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -set NO_VEX 1 -d C4E1FB93D8 diff --git a/tests/tests-avx512/test-00026/codes b/tests/tests-avx512/test-00026/codes new file mode 100644 index 00000000..7c174334 --- /dev/null +++ b/tests/tests-avx512/test-00026/codes @@ -0,0 +1 @@ +DEC AVX512X diff --git a/tests/tests-avx512/test-00026/retcode.reference b/tests/tests-avx512/test-00026/retcode.reference new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests/tests-avx512/test-00026/retcode.reference @@ -0,0 +1 @@ +1 diff --git a/tests/tests-avx512/test-00026/stderr.reference b/tests/tests-avx512/test-00026/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-avx512/test-00026/stdout.reference b/tests/tests-avx512/test-00026/stdout.reference new file mode 100644 index 00000000..a7ebc96b --- /dev/null +++ b/tests/tests-avx512/test-00026/stdout.reference @@ -0,0 +1,2 @@ +C4E1FB93D8 +ERROR: GENERAL_ERROR Could not decode at offset: 0x0 len: 2 PC: 0x0: [C4E1] diff --git a/tests/tests-avx512/test-00027/cmd b/tests/tests-avx512/test-00027/cmd new file mode 100644 index 00000000..677e147a --- /dev/null +++ b/tests/tests-avx512/test-00027/cmd @@ -0,0 +1 @@ + BUILDDIR/xed -set NO_EVEX 1 -d 62 F2 7D 48 13 C0 diff --git a/tests/tests-avx512/test-00027/codes b/tests/tests-avx512/test-00027/codes new file mode 100644 index 00000000..7c174334 --- /dev/null +++ b/tests/tests-avx512/test-00027/codes @@ -0,0 +1 @@ +DEC AVX512X diff --git a/tests/tests-avx512/test-00027/retcode.reference b/tests/tests-avx512/test-00027/retcode.reference new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests/tests-avx512/test-00027/retcode.reference @@ -0,0 +1 @@ +1 diff --git a/tests/tests-avx512/test-00027/stderr.reference b/tests/tests-avx512/test-00027/stderr.reference new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests-avx512/test-00027/stdout.reference b/tests/tests-avx512/test-00027/stdout.reference new file mode 100644 index 00000000..32fe7e11 --- /dev/null +++ b/tests/tests-avx512/test-00027/stdout.reference @@ -0,0 +1,2 @@ +62F27D4813C0 +ERROR: GENERAL_ERROR Could not decode at offset: 0x0 len: 2 PC: 0x0: [62F2] diff --git a/tests/tests-base/test-00150/stdout.reference b/tests/tests-base/test-00150/stdout.reference index 050eb824..80ee75ca 100644 --- a/tests/tests-base/test-00150/stdout.reference +++ b/tests/tests-base/test-00150/stdout.reference @@ -13,7 +13,7 @@ Nominal opcode 0x12 Operands # TYPE DETAILS VIS RW OC2 BITS BYTES NELEM ELEMSZ ELEMTYPE REGCLASS # ==== ======= === == === ==== ===== ===== ====== ======== ======== -0 REG0 REG0=XMM0 EXPLICIT W Q 64 8 2 32 SINGLE XMM +0 REG0 REG0=XMM0 EXPLICIT RW Q 64 8 2 32 SINGLE XMM 1 REG1 REG1=XMM0 EXPLICIT R Q 64 8 2 32 SINGLE XMM Memory Operands MemopBytes = 0 diff --git a/tests/tests-base/test-00182/stdout.reference b/tests/tests-base/test-00182/stdout.reference index 99461e26..e53f9bc7 100644 --- a/tests/tests-base/test-00182/stdout.reference +++ b/tests/tests-base/test-00182/stdout.reference @@ -27,3 +27,7 @@ FLAGS: undefined: fc0 fc2 fc3 mask=0xd0000000 ATTRIBUTES: NOTSX ISA SET: [FCMOV] +0 CPUID BIT NAME: [CMOV] + Leaf 0x00000001, subleaf 0x00000000, EDX[15] +1 CPUID BIT NAME: [FPU] + Leaf 0x00000001, subleaf 0x00000000, EDX[0] diff --git a/tests/tests-base/test-00183/stdout.reference b/tests/tests-base/test-00183/stdout.reference index f785dfba..0a05b8f8 100644 --- a/tests/tests-base/test-00183/stdout.reference +++ b/tests/tests-base/test-00183/stdout.reference @@ -27,3 +27,7 @@ FLAGS: undefined: fc0 fc2 fc3 mask=0xd0000000 ATTRIBUTES: NOTSX ISA SET: [FCMOV] +0 CPUID BIT NAME: [CMOV] + Leaf 0x00000001, subleaf 0x00000000, EDX[15] +1 CPUID BIT NAME: [FPU] + Leaf 0x00000001, subleaf 0x00000000, EDX[0] diff --git a/tests/tests-base/test-00305/cmd b/tests/tests-base/test-00305/cmd index 0e2291f5..b4b3501e 100644 --- a/tests/tests-base/test-00305/cmd +++ b/tests/tests-base/test-00305/cmd @@ -1 +1 @@ - BUILDDIR/xed -64 -de 0f1aff + BUILDDIR/xed -64 -d 0f1aff diff --git a/tests/tests-base/test-00305/codes b/tests/tests-base/test-00305/codes index 209ec74d..10759ce9 100644 --- a/tests/tests-base/test-00305/codes +++ b/tests/tests-base/test-00305/codes @@ -1 +1 @@ -DEC ENC +DEC diff --git a/tests/tests-base/test-00305/stdout.reference b/tests/tests-base/test-00305/stdout.reference index 1dbbc12f..7edd421e 100644 --- a/tests/tests-base/test-00305/stdout.reference +++ b/tests/tests-base/test-00305/stdout.reference @@ -6,11 +6,3 @@ IFORM: NOP_GPRv_GPRv_0F1A ISA_SET: PPRO ATTRIBUTES: NOP SCALABLE SHORT: nop edi, edi -Encodable! 0F1FFF -Discrepenacy after re-encoding. dec_len= 3 [0F1AFF] enc_olen= 3 [0F1FFF] for instruction: NOP NOP_GPRv_GPRv_0F1A EASZ:3, EOSZ:2, HAS_MODRM:1, LZCNT, MAP:1, MAX_BYTES:3, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:26, OUTREG:EDI, P4, POS_MODRM:2, POS_NOMINAL_OPCODE:1, REG:7, REG0:EDI, REG1:EDI, RM:7, SMODE:2, SRM:2, TZCNT -0 REG0/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_B -1 REG1/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_R -YDIS: nop edi, edi -vs Encode request: NOP EASZ:3, EOSZ:2, HAS_MODRM:1, LZCNT, MAP:1, MAX_BYTES:3, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:26, OUTREG:EDI, P4, POS_MODRM:2, POS_NOMINAL_OPCODE:1, REG:7, REG0:EDI, REG1:EDI, RM:7, SMODE:2, SRM:2, TZCNT -OPERAND ORDER: REG0 REG1 - diff --git a/tests/tests-base/test-00306/cmd b/tests/tests-base/test-00306/cmd index 56ed0396..a23db2ba 100644 --- a/tests/tests-base/test-00306/cmd +++ b/tests/tests-base/test-00306/cmd @@ -1 +1 @@ - BUILDDIR/xed -64 -de 0f1bff + BUILDDIR/xed -64 -d 0f1bff diff --git a/tests/tests-base/test-00306/codes b/tests/tests-base/test-00306/codes index 209ec74d..10759ce9 100644 --- a/tests/tests-base/test-00306/codes +++ b/tests/tests-base/test-00306/codes @@ -1 +1 @@ -DEC ENC +DEC diff --git a/tests/tests-base/test-00306/stdout.reference b/tests/tests-base/test-00306/stdout.reference index 40ae0bbe..32ab816f 100644 --- a/tests/tests-base/test-00306/stdout.reference +++ b/tests/tests-base/test-00306/stdout.reference @@ -6,11 +6,3 @@ IFORM: NOP_GPRv_GPRv_0F1B ISA_SET: PPRO ATTRIBUTES: NOP SCALABLE SHORT: nop edi, edi -Encodable! 0F1FFF -Discrepenacy after re-encoding. dec_len= 3 [0F1BFF] enc_olen= 3 [0F1FFF] for instruction: NOP NOP_GPRv_GPRv_0F1B EASZ:3, EOSZ:2, HAS_MODRM:1, LZCNT, MAP:1, MAX_BYTES:3, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:27, OUTREG:EDI, P4, POS_MODRM:2, POS_NOMINAL_OPCODE:1, REG:7, REG0:EDI, REG1:EDI, RM:7, SMODE:2, SRM:3, TZCNT -0 REG0/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_B -1 REG1/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_R -YDIS: nop edi, edi -vs Encode request: NOP EASZ:3, EOSZ:2, HAS_MODRM:1, LZCNT, MAP:1, MAX_BYTES:3, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:27, OUTREG:EDI, P4, POS_MODRM:2, POS_NOMINAL_OPCODE:1, REG:7, REG0:EDI, REG1:EDI, RM:7, SMODE:2, SRM:3, TZCNT -OPERAND ORDER: REG0 REG1 - diff --git a/tests/tests-base/test-00307/cmd b/tests/tests-base/test-00307/cmd index a9aaa9cf..97df8a12 100644 --- a/tests/tests-base/test-00307/cmd +++ b/tests/tests-base/test-00307/cmd @@ -1 +1 @@ - BUILDDIR/xed -64 -de f30f1bff + BUILDDIR/xed -64 -d f30f1bff diff --git a/tests/tests-base/test-00307/codes b/tests/tests-base/test-00307/codes index 209ec74d..10759ce9 100644 --- a/tests/tests-base/test-00307/codes +++ b/tests/tests-base/test-00307/codes @@ -1 +1 @@ -DEC ENC +DEC diff --git a/tests/tests-base/test-00307/stdout.reference b/tests/tests-base/test-00307/stdout.reference index b96a4c45..b32df163 100644 --- a/tests/tests-base/test-00307/stdout.reference +++ b/tests/tests-base/test-00307/stdout.reference @@ -6,11 +6,3 @@ IFORM: NOP_GPRv_GPRv_0F1B ISA_SET: PPRO ATTRIBUTES: NOP SCALABLE SHORT: nop edi, edi -Encodable! F30F1FFF -Discrepenacy after re-encoding. dec_len= 4 [F30F1BFF] enc_olen= 4 [F30F1FFF] for instruction: NOP NOP_GPRv_GPRv_0F1B EASZ:3, EOSZ:2, FIRST_F2F3:3, HAS_MODRM:1, ILD_F3, LAST_F2F3:3, LZCNT, MAP:1, MAX_BYTES:4, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:27, NPREFIXES:1, OUTREG:EDI, P4, POS_MODRM:3, POS_NOMINAL_OPCODE:2, REG:7, REG0:EDI, REG1:EDI, REP:3, RM:7, SMODE:2, SRM:3, TZCNT -0 REG0/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_B -1 REG1/R/V/EXPLICIT/NT_LOOKUP_FN/GPRV_R -YDIS: nop edi, edi -vs Encode request: NOP EASZ:3, EOSZ:2, FIRST_F2F3:3, HAS_MODRM:1, ILD_F3, LAST_F2F3:3, LZCNT, MAP:1, MAX_BYTES:4, MOD:3, MODE:2, MODRM_BYTE:255, NOMINAL_OPCODE:27, NPREFIXES:1, OUTREG:EDI, P4, POS_MODRM:3, POS_NOMINAL_OPCODE:2, REG:7, REG0:EDI, REG1:EDI, REP:3, RM:7, SMODE:2, SRM:3, TZCNT -OPERAND ORDER: REG0 REG1 - diff --git a/tests/tests-base/test-00517/codes b/tests/tests-base/test-00517/codes index 7e5fad86..f3993dbc 100644 --- a/tests/tests-base/test-00517/codes +++ b/tests/tests-base/test-00517/codes @@ -1 +1 @@ -DEC +DEC AVX512X diff --git a/tests/tests-base/test-00518/codes b/tests/tests-base/test-00518/codes index 7e5fad86..f3993dbc 100644 --- a/tests/tests-base/test-00518/codes +++ b/tests/tests-base/test-00518/codes @@ -1 +1 @@ -DEC +DEC AVX512X diff --git a/tests/tests-base/test-00519/codes b/tests/tests-base/test-00519/codes index 7e5fad86..f3993dbc 100644 --- a/tests/tests-base/test-00519/codes +++ b/tests/tests-base/test-00519/codes @@ -1 +1 @@ -DEC +DEC AVX512X diff --git a/tests/tests-base/test-00533/stdout.reference b/tests/tests-base/test-00533/stdout.reference index 08f82864..fe85a6f8 100644 --- a/tests/tests-base/test-00533/stdout.reference +++ b/tests/tests-base/test-00533/stdout.reference @@ -22,3 +22,5 @@ EXCEPTION TYPE: MMX_MEM ISA SET: [SSSE3MMX] 0 CPUID BIT NAME: [SSSE3] Leaf 0x00000001, subleaf 0x00000000, ECX[9] +1 CPUID BIT NAME: [MMX] + Leaf 0x00000001, subleaf 0x00000000, EDX[23] diff --git a/tests/tests-base/test-00534/stdout.reference b/tests/tests-base/test-00534/stdout.reference index 03b04ece..ce39c14e 100644 --- a/tests/tests-base/test-00534/stdout.reference +++ b/tests/tests-base/test-00534/stdout.reference @@ -23,3 +23,5 @@ EXCEPTION TYPE: MMX_MEM ISA SET: [SSSE3MMX] 0 CPUID BIT NAME: [SSSE3] Leaf 0x00000001, subleaf 0x00000000, ECX[9] +1 CPUID BIT NAME: [MMX] + Leaf 0x00000001, subleaf 0x00000000, EDX[23] diff --git a/xed_mbuild.py b/xed_mbuild.py index 5b0f15b1..c3f29201 100755 --- a/xed_mbuild.py +++ b/xed_mbuild.py @@ -824,6 +824,14 @@ def xed_args(env): action="store_false", dest="future", help="Do not include future NI.") + env.parser.add_option("--no-amd", + action="store_false", + dest="amd_enabled", + help="Disable AMD public instructions") + env.parser.add_option("--no-via", + action="store_false", + dest="via_enabled", + help="Disable VIA public instructions") env.parser.add_option("--dbghelp", action="store_true", dest="dbghelp", @@ -846,14 +854,6 @@ def xed_args(env): action="store", help="Kit version string. " + "The default is 'base'") - env.parser.add_option("--no-amd", - action="store_false", - dest="amd_enabled", - help="Disable AMD public instructions") - env.parser.add_option("--no-via", - action="store_false", - dest="via_enabled", - help="Disable VIA public instructions") env.parser.add_option("--limit-strings", action="store_true", dest="limit_strings", @@ -897,10 +897,6 @@ def xed_args(env): action="store_true", dest="use_elf_dwarf", help="Use libelf/libdwarf. (Linux only)") - env.parser.add_option('--dev', - action='store_true', - dest='dev', - help='Developer knob. Updates VERSION file') env.parser.add_option("--elf-dwarf-precompiled", action="store_true", dest="use_elf_dwarf_precompiled", @@ -1002,7 +998,7 @@ def init(env): xbc.init(env) - env.add_define('XED_GIT_VERSION="%(xed_git_version)s"') + env.add_define('XED_VERSION="%(xed_version)s"') if env['shared']: env.add_define('XED_DLL') @@ -1445,14 +1441,10 @@ def _add_normal_ext(tenv,x , y='files.cfg'): _add_normal_ext(env,'tdx') _add_normal_ext(env,'avx512-fp16') _add_normal_ext(env,'evex-map5-6') - - if env['future']: - _add_normal_ext(env,'future') - _add_normal_ext(env,'tdx') - + if env['future']: + _add_normal_ext(env,'future') - env['extf'] = newstuff + env['extf'] def _get_src(env,subdir): @@ -2392,42 +2384,36 @@ def get_git_cmd(env): git = gite return git -def autodev(env): - if env['dev']: - return True - if os.path.exists(mbuild.join(env['src_dir'],".developer")): - return True - return False def get_git_version(env): - fn = mbuild.join(env['src_dir'],'VERSION') - # are we in a GIT repo? - if os.path.exists(mbuild.join(env['src_dir'],'.git')): - cmd = get_git_cmd(env) + ' describe --tags' - (retcode, stdout, stderr) = mbuild.run_command(cmd, + NO_VERSION = '000' + + # are we in a GIT repo? + if os.path.exists(mbuild.join(env['src_dir'],'.git')): + cmd = get_git_cmd(env) + ' describe --tags' + (retcode, stdout, stderr) = mbuild.run_command(cmd, directory=env['src_dir']) - if retcode == 0: - # git worked, update VERSION file - line = stdout[0].strip() - # update the VERSION file conditionally. It will mess up nightly - # machines to modify a tracked file on every build. - if autodev(env): - f = open(fn,'w') - f.write(line + "\n") - f.close() - - return line - else: - xbc.dump_lines("git description stdout", stdout) - xbc.dump_lines("git description stderr", stderr) - - # not a git repo or git failed or was not found. - try: - lines = open(fn,'r').readlines() - line = lines[0].strip() - return line - except: - xbc.cdie("Could not find VERSION file, git or git repo") + if retcode == 0: + line = stdout[0].strip() + return line + else: + xbc.dump_lines("git version description", "FAILED") + xbc.dump_lines("git description stdout", stdout) + xbc.dump_lines("git description stderr", stderr) + + # not a git repo or git failed. + # search for VERSION file (Available with the public XED repository) + version_file = mbuild.join(env['src_dir'], 'VERSION') + if os.path.exists(version_file): + try: + with open(version_file, 'r') as f: + line = f.readline() + return line.strip() + except: + xbc.dump_lines("Could not find VERSION file or git repo for versioning") + + return NO_VERSION + def emit_defines_header(env): """Grab all the XED_* defines and the model name and emit a header file""" @@ -2477,22 +2463,8 @@ def _emit_define(s): def update_version(env): new_rev = get_git_version(env) - date = time.strftime("%Y-%m-%d") - if new_rev: - mbuild.vmsgb(1, "GIT VERSION", new_rev) - else: - new_rev = "000" - mbuild.warn("Could not find GIT revision number") - - # For developer builds, include the date in the git version. For - # non developer builds, do not include the date. The git version - # gets put in the xed-build-defines.h file. If the git version - # includes the date, it would trigger rebuilds on a daily basis. - - if autodev(env): - env['xed_git_version'] = new_rev + " " + date - else: - env['xed_git_version'] = new_rev + mbuild.vmsgb(1, "XED VERSION", new_rev) + env['xed_version'] = new_rev def _test_setup(env): osenv = None @@ -2541,7 +2513,7 @@ def _run_canned_tests(env,osenv): wkit = env['wkit'] cmd = "%(python)s %(test_dir)s/run-cmd.py --build-dir {} ".format(wkit.bin) - dirs = ['tests-base', 'tests-knc', 'tests-avx512', 'tests-xop', 'tests-syntax'] + dirs = ['tests-base', 'tests-knc', 'tests-avx512', 'tests-xop', 'tests-syntax', 'tests-amx'] if env['cet']: dirs.append('tests-cet') for d in dirs: @@ -2560,6 +2532,8 @@ def _run_canned_tests(env,osenv): codes.append('KNC') if env['skx']: codes.append('AVX512X') + if env['spr']: + codes.append('AMX') if env['knm'] or env['knl']: codes.append('AVX512PF') if env['hsw']: