Repository: spack/spack

Issue:
phist@1.11.2 fails build on ARM64: kernels/builtin/axpy_kernels_nt.c:22:10: fatal error: emmintrin.h: No such file or directory
### Steps to reproduce the issue

`phist@1.11.2` build fails using:
* `spack@develop` (09e1258ed42f00ea9bde9857f233eeda5c61a895 from `Sat Jul 8 15:36:27 2023 -0500`)
* GCC 11.1.0
* Ubuntu 20.04, ARM64

Spack environment: [spack.yaml.txt](https://github.com/spack/spack/files/11992642/spack.yaml.txt)

<details><summary>Concretization</summary>
<pre>
 -   5bv4pof  phist@1.11.2%gcc@11.1.0+fortran+host+int64~ipo+mpi+openmp~parmetis+scamac+shared~trilinos build_system=cmake build_type=Release generator=make kernel_lib=builtin outlev=2 patches=1fc9ac6 arch=linux-ubuntu20.04-aarch64
[+]  cib64fo      ^cmake@3.26.3%gcc@11.1.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu20.04-aarch64
[+]  tq4s2d2          ^ncurses@6.3%gcc@11.1.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  2yo52cd          ^openssl@1.1.1u%gcc@11.1.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu20.04-aarch64
[+]  esd7eb6              ^ca-certificates-mozilla@2023-01-10%gcc@11.1.0 build_system=generic arch=linux-ubuntu20.04-aarch64
[+]  6iddyph      ^gmake@4.4.1%gcc@11.1.0~guile build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  67iy4j5          ^gnuconfig@2022-09-17%gcc@11.1.0 build_system=generic arch=linux-ubuntu20.04-aarch64
[+]  la56q6q      ^mpich@4.1.1%gcc@11.1.0~argobots~cuda+fortran~hwloc+hydra+libxml2+pci~rocm+romio~slurm~two_level_namespace~vci~verbs~wrapperrpath build_system=autotools datatype-engine=auto device=ch4 netmod=ofi pmi=pmi arch=linux-ubuntu20.04-aarch64
[+]  jyhftkv          ^findutils@4.9.0%gcc@11.1.0 build_system=autotools patches=440b954 arch=linux-ubuntu20.04-aarch64
[+]  wr2tvqh          ^libfabric@1.18.1%gcc@11.1.0~debug~kdreg build_system=autotools fabrics=rxm,sockets,tcp,udp arch=linux-ubuntu20.04-aarch64
[+]  rn4yory          ^libpciaccess@0.17%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  jkbd2o4              ^libtool@2.4.7%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  ywapq5v              ^util-macros@1.19.3%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  k5yt2z5          ^libxml2@2.10.3%gcc@11.1.0~python build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  hrknc7y              ^libiconv@1.17%gcc@11.1.0 build_system=autotools libs=shared,static arch=linux-ubuntu20.04-aarch64
[+]  352xzo3          ^pkgconf@1.9.5%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  g33gvtp          ^yaksa@0.2%gcc@11.1.0~cuda~rocm build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  qbsn4gd              ^autoconf@2.69%gcc@11.1.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu20.04-aarch64
[+]  2e2so7h              ^automake@1.16.5%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  uhlwdot              ^m4@1.4.19%gcc@11.1.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu20.04-aarch64
[+]  gbmzhic                  ^libsigsegv@2.14%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  apntqpp      ^openblas@0.3.23%gcc@11.1.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=openmp arch=linux-ubuntu20.04-aarch64
[+]  x52hmjj          ^perl@5.38.0%gcc@11.1.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu20.04-aarch64
[+]  rke2xrc              ^berkeley-db@18.1.40%gcc@11.1.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu20.04-aarch64
[+]  5crj7v2      ^python@3.10.12%gcc@11.1.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-ubuntu20.04-aarch64
[+]  hcntjnj          ^bzip2@1.0.8%gcc@11.1.0~debug~pic+shared build_system=generic arch=linux-ubuntu20.04-aarch64
[+]  xx5z4xk              ^diffutils@3.9%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  ljb5exf          ^expat@2.5.0%gcc@11.1.0+libbsd build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  euclh35              ^libbsd@0.11.7%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  oms2klk                  ^libmd@1.0.4%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  qhmcs6x          ^gdbm@1.23%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  vy4wcv5          ^gettext@0.21.1%gcc@11.1.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  fxfhemw              ^tar@1.34%gcc@11.1.0 build_system=autotools zip=pigz arch=linux-ubuntu20.04-aarch64
[+]  h3c7ba6                  ^pigz@2.7%gcc@11.1.0 build_system=makefile arch=linux-ubuntu20.04-aarch64
[+]  dzvxsh7                  ^zstd@1.5.5%gcc@11.1.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu20.04-aarch64
[+]  amu3day          ^libffi@3.4.4%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  rqy5l5i          ^libxcrypt@4.4.35%gcc@11.1.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu20.04-aarch64
[+]  rugrrau          ^readline@8.2%gcc@11.1.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu20.04-aarch64
[+]  nxqd2ih          ^sqlite@3.42.0%gcc@11.1.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  2jofsst          ^util-linux-uuid@2.38.1%gcc@11.1.0 build_system=autotools arch=linux-ubuntu20.04-aarch64
[+]  izauomq          ^xz@5.4.1%gcc@11.1.0+pic build_system=autotools libs=shared,static arch=linux-ubuntu20.04-aarch64
[+]  c7nojld          ^zlib@1.2.13%gcc@11.1.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu20.04-aarch64
</pre>
</details>

Error:
```
$> spack -e . install
...
==> Installing phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb
==> No binary for phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/e2/e23f76307c26b930f7331a734b0a864ea6d7fb4a13c12f3c5d70c2c41481747b.tar.gz
==> Applied patch /spack/var/spack/repos/builtin/packages/phist/sbang.patch
==> Ran patch() for phist
==> phist: Executing phase: 'cmake'
==> phist: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    '/spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/gmake-4.4.1-6iddypha2yhaos2uprfaop3rfbclkcf7/bin/make' '-j32'

8 errors found in build log:
     444     [ 21%] Generating precon_d/precon_d.h
     445     cd /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings && sed s/"^#.*"//g /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-buil
             d-5bv4pof/fortran_bindings/precon_d/precon_d-2.CFWRAPPER_SKIP.h > /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings/precon_d/precon_d.h
     446     [ 22%] Generating precon_c/precon_c.h
     447     cd /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings && sed s/"^#.*"//g /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-buil
             d-5bv4pof/fortran_bindings/precon_c/precon_c-2.CFWRAPPER_SKIP.h > /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings/precon_c/precon_c.h
     448     [ 22%] Generating phist_kernels.F90, phist_jada.F90, phist_tools.F90, phist_tools_s.F90, phist_tools_d.F90, phist_tools_c.F90, phist_tools_z.F90, phist_kernels_s.F90, phist_kernels_d.F90, phist_kernels_c.F90, phist_kernels_z.F90,
              phist_core_s.F90, phist_core_d.F90, phist_core_c.F90, phist_core_z.F90, phist_krylov_s.F90, phist_krylov_d.F90, phist_krylov_c.F90, phist_krylov_z.F90, phist_jada_s.F90, phist_jada_d.F90, phist_jada_c.F90, phist_jada_z.F90, phis
             t_precon_s.F90, phist_precon_d.F90, phist_precon_c.F90, phist_precon_z.F90
     449     cd /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings && ./cfwrapper.py
  >> 450     /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings/./cfwrapper.py:268: DeprecationWarning: 'U' mode is deprecated
     451       whole_file = open(directory[0] + "/" + c_file_name, 'rU',
  >> 452     /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings/./cfwrapper.py:342: DeprecationWarning: 'U' mode is deprecated
     453       whole_file_original = open(directory[0] + "/" + c_file_name, 'rU',
     454
     455     Current directory: /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/fortran_bindings
     456
     457     Pass 1: looking for enumerators, funptr and derived types...
     458     Pass 2: looking for C functions...

     ...

     1153    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/mpich-4.1.1-la56q6qmhnlgtwksq4vpn6mnewxxgzg3/bin/mpic++ -Dphist_kernels_builtin_EXPORTS -I/spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/openblas-0.3.23-apntqppplgorwh6
             qpr3dp5ny3pox3axi/include -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/drivers/matfuncs -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/dr
             ivers/matfuncs/scamac -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/drivers/matfuncs/scamac -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb
             /spack-build-5bv4pof -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/
             builtin -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/trilinos_interface -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/to
             ols -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/core -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/krylov -I/tmp/root/spack-sta
             ge/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/jada -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/precon -I/tmp/root/spack-stage/spack-stage-phist-1.11
             .2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/drivers -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/cxx_bindings -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacag
             cksw3uh3wrx4lezb56myb/spack-src/lib/googletest-master-12-2015 -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src -march=native     -fopenmp -O3 -fno-math-errno -ffinite-math-only -fno-
             signed-zeros -fno-trapping-math -std=gnu++11 -fPIC -MD -MT CMakeFiles/phist_kernels_builtin.dir/src/kernels/common/kernels_common_impl.cpp.o -MF CMakeFiles/phist_kernels_builtin.dir/src/kernels/common/kernels_common_impl.cpp.o.d
             -o CMakeFiles/phist_kernels_builtin.dir/src/kernels/common/kernels_common_impl.cpp.o -c /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/common/kernels_common_impl.cpp
     1154    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/mpich-4.1.1-la56q6qmhnlgtwksq4vpn6mnewxxgzg3/bin/mpicc -Dphist_kernels_builtin_EXPORTS -I/spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/openblas-0.3.23-apntqppplgorwh6q
             pr3dp5ny3pox3axi/include -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/drivers/matfuncs -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/dri
             vers/matfuncs/scamac -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/drivers/matfuncs/scamac -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/
             spack-build-5bv4pof -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/b
             uiltin -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/trilinos_interface -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/too
             ls -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/core -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/krylov -I/tmp/root/spack-stag
             e/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/jada -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/precon -I/tmp/root/spack-stage/spack-stage-phist-1.11.
             2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/drivers -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof/cxx_bindings -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagc
             ksw3uh3wrx4lezb56myb/spack-src/lib/googletest-master-12-2015 -I/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src -march=native       -fopenmp -O3 -fno-math-errno -ffinite-math-only -fno
             -signed-zeros -fno-trapping-math -std=gnu99 -fPIC -MD -MT CMakeFiles/phist_kernels_builtin.dir/src/kernels/common/stream_bench.c.o -MF CMakeFiles/phist_kernels_builtin.dir/src/kernels/common/stream_bench.c.o.d -o CMakeFiles/phist
             _kernels_builtin.dir/src/kernels/common/stream_bench.c.o -c /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/common/stream_bench.c
     1155    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/cmake-3.26.3-cib64fo6iqykcbtcbmtgdyivvlcof2s2/bin/cmake -E cmake_copy_f90_mod tritoeplitz_module.mod CMakeFiles/phist_kernels_builtin.dir/tritoeplitz_module.mod.stamp GNU
     1156    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/cmake-3.26.3-cib64fo6iqykcbtcbmtgdyivvlcof2s2/bin/cmake -E cmake_copy_f90_mod brussolator_module.mod CMakeFiles/phist_kernels_builtin.dir/brussolator_module.mod.stamp GNU
     1157    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/cmake-3.26.3-cib64fo6iqykcbtcbmtgdyivvlcof2s2/bin/cmake -E touch CMakeFiles/phist_kernels_builtin.dir/drivers/matfuncs/tritoeplitz.F90.o.provides.build
     1158    /spack/opt/spack/linux-ubuntu20.04-aarch64/gcc-11.1.0/cmake-3.26.3-cib64fo6iqykcbtcbmtgdyivvlcof2s2/bin/cmake -E touch CMakeFiles/phist_kernels_builtin.dir/drivers/matfuncs/brussolator.F90.o.provides.build
  >> 1159    /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/builtin/axpy_kernels_nt.c:22:10: fatal error: emmintrin.h: No such file or directory
     1160       22 | #include <emmintrin.h>
     1161          |          ^~~~~~~~~~~~~
     1162    compilation terminated.
  >> 1163    /tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-src/src/kernels/builtin/spmvm_kernels_nt.c:22:10: fatal error: emmintrin.h: No such file or directory
     1164       22 | #include <emmintrin.h>
     1165          |          ^~~~~~~~~~~~~
     1166    compilation terminated.
  >> 1167    make[2]: *** [CMakeFiles/phist_kernels_builtin.dir/build.make:292: CMakeFiles/phist_kernels_builtin.dir/src/kernels/builtin/axpy_kernels_nt.c.o] Error 1
     1168    make[2]: *** Waiting for unfinished jobs....
  >> 1169    make[2]: *** [CMakeFiles/phist_kernels_builtin.dir/build.make:397: CMakeFiles/phist_kernels_builtin.dir/src/kernels/builtin/spmvm_kernels_nt.c.o] Error 1
     1170    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof'
  >> 1171    make[1]: *** [CMakeFiles/Makefile2:317: CMakeFiles/phist_kernels_builtin.dir/all] Error 2
     1172    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-phist-1.11.2-5bv4pofacagcksw3uh3wrx4lezb56myb/spack-build-5bv4pof'
  >> 1173    make: *** [Makefile:169: all] Error 2
```

### Error message

<details><summary>Error message</summary>
<pre>
... see above
</pre></details>


### Information on your system

* **Spack:** 0.21.0.dev0 (09e1258ed42f00ea9bde9857f233eeda5c61a895)
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-neoverse_n1
* **Concretizer:** clingo

### Additional information

[spack-build-env.txt](https://github.com/spack/spack/files/11992640/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/11992641/spack-build-out.txt)

@jthies @wspear 

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Thanks for reporting this. I think the builtin kernels require SSE, and this is not supported on ARM. I'll try to fix this.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/phist/package.py b/var/spack/repos/builtin/packages/phist/package.py
--- a/var/spack/repos/builtin/packages/phist/package.py
+++ b/var/spack/repos/builtin/packages/phist/package.py
@@ -150,6 +150,10 @@ class Phist(CMakePackage):
 
     # ###################### Patches ##########################
 
+    # Avoid trying to compile some SSE code if SSE is not available
+    # This patch will be part of phist 1.11.3 and greater and only affects
+    # the 'builtin' kernel_lib.
+    patch("avoid-sse.patch", when="@:1.11.2 kernel_lib=builtin")
     # Only applies to 1.9.4: While SSE instructions are handled correctly,
     # build fails on ppc64le unless -DNO_WARN_X86_INTRINSICS is defined.
     patch("ppc64_sse.patch", when="@1.9.4")


Test patch: