Text file src/simd/archsimd/_gen/fetch-xed.sh

     1  #!/bin/bash
     2  
     3  # Copyright 2026 The Go Authors. All rights reserved.
     4  # Use of this source code is governed by a BSD-style
     5  # license that can be found in the LICENSE file.
     6  
     7  
     8  # This is based on the instructions at https://github.com/intelxed/xed
     9  
    10  set -e
    11  
    12  XEDTAG=v2025.03.02
    13  MBUILDTAG=v2024.11.04
    14  DATA=./extern
    15  
    16  trace() {
    17      set -x
    18      "$@"
    19      { local rc=$?; set +x; } 2>/dev/null
    20      return $rc
    21  }
    22  
    23  echo "This will download xed to $DATA/xed and $DATA/mbuild and compile it."
    24  echo "It requires Python, a C toolchain, and probably other things."
    25  read -p "Continue (y/n)? " -n 1 -r
    26  echo
    27  if [[ ! $REPLY =~ ^[Yy]$ ]]; then
    28      exit 1
    29  fi
    30  
    31  if [[ -d "$DATA/xed" ]]; then
    32      echo 2>&1 "$DATA/xed already downloaded"
    33  else
    34      trace git clone -b $XEDTAG https://github.com/intelxed/xed.git $DATA/xed
    35  fi
    36  if [[ -d "$DATA/mbuild" ]]; then
    37      echo 2>&1 "$DATA/mbuild already downloaded"
    38  else
    39      trace git clone -b $MBUILDTAG https://github.com/intelxed/mbuild.git $DATA/mbuild
    40  fi
    41  
    42  if [[ -f $DATA/xed/obj/dgen/all-dec-instructions.txt ]]; then
    43      echo 2>&1 "XED data already compiled"
    44  else
    45      trace cd $DATA/xed
    46      trace ./mfile.py
    47  fi
    48  

View as plain text