#!/usr/bin/bash

# This shell script will build vectorized and un-vectorized versions of code
# for x86_64 and  AArch64
# Must have the AArch64 cross compiler placed in your home dir under ~/aarch

# Build the x86 with O1 and -ftree-vectorize -fopt-info-vec-all and static

ARM=~/aarch/bin/aarch64-none-linux-gnu-gcc
echo "Building x86"

echo "Vectorized"
gcc -static -O1 -ftree-vectorize -msse -fopt-info-vec-all $1.c -o $1-x86-vec

echo "No vectorize"
gcc -static -O1  -msse $1.c -o $1-x86-nvec

echo "Building AArch64"

echo "Vectorized"
$ARM -static -O1 -ftree-vectorize -fopt-info-vec-all $1.c -o $1-arm-vec

echo "No vectorize"
$ARM -static -O1 $1.c -o $1-arm-nvec