module _Builtin_intrinsics [system] [extern_c] {
  explicit module altivec {
    requires altivec
    header "altivec.h"
  }

  explicit module arm {
    requires arm

    explicit module acle {
      header "arm_acle.h"
      export *
    }

    explicit module neon {
      requires neon
      header "arm_neon.h"
      export *
    }
  }

  explicit module intel {
    requires x86
    export *

    header "immintrin.h"
    header "x86intrin.h"

    explicit module mm_malloc {
      header "mm_malloc.h"
      export * // note: for <stdlib.h> dependency
    }

    explicit module cpuid {
      header "cpuid.h"
    }

    explicit module mmx {
      header "mmintrin.h"
    }

    explicit module f16c {
      header "f16cintrin.h"
    }

    explicit module sse {
      export mmx
      export sse2 // note: for hackish <emmintrin.h> dependency
      header "xmmintrin.h"
    }

    explicit module sse2 {
      export sse
      header "emmintrin.h"
    }

    explicit module sse3 {
      export sse2
      header "pmmintrin.h"
    }

    explicit module ssse3 {
      export sse3
      header "tmmintrin.h"
    }

    explicit module sse4_1 {
      export ssse3
      header "smmintrin.h"
    }

    explicit module sse4_2 {
      export sse4_1
      header "nmmintrin.h"
    }

    explicit module sse4a {
      export sse3
      header "ammintrin.h"
    }

    explicit module avx {
      export sse4_2
      header "avxintrin.h"
    }

    explicit module avx2 {
      export avx
      header "avx2intrin.h"
    }

    explicit module avx512f {
      export avx2
      header "avx512fintrin.h"
    }

    explicit module avx512er {
      header "avx512erintrin.h"
    }

    explicit module bmi {
      header "bmiintrin.h"
    }

    explicit module bmi2 {
      header "bmi2intrin.h"
    }

    explicit module fma {
      header "fmaintrin.h"
    }

    explicit module fma4 {
      export sse3
      header "fma4intrin.h"
    }

    explicit module lzcnt {
      header "lzcntintrin.h"
    }

    explicit module popcnt {
      header "popcntintrin.h"
    }

    explicit module mm3dnow {
      header "mm3dnow.h"
    }

    explicit module xop {
      export fma4
      header "xopintrin.h"
    }

    explicit module aes_pclmul {
      header "wmmintrin.h"
      export aes
      export pclmul
    }

    explicit module aes {
      header "__wmmintrin_aes.h"
    }

    explicit module pclmul {
      header "__wmmintrin_pclmul.h"
    }
  }

  explicit module systemz {
    requires systemz
    export *

    header "s390intrin.h"

    explicit module htm {
      requires htm
      header "htmintrin.h"
      header "htmxlintrin.h"
    }

    explicit module zvector {
      requires zvector, vx
      header "vecintrin.h"
    }
  }
}

module _Builtin_stddef_max_align_t [system] [extern_c] {
  header "__stddef_max_align_t.h"
}
