clc: add 32-bit target
authorItalo Nicola <italonicola@collabora.com>
Thu, 6 Oct 2022 12:18:45 +0000 (12:18 +0000)
committerMarge Bot <emma+marge@anholt.net>
Sat, 15 Oct 2022 02:23:03 +0000 (02:23 +0000)
Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18985>

src/compiler/clc/clc.h
src/compiler/clc/clc_helpers.cpp
src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs

index d544730..71a763b 100644 (file)
@@ -76,6 +76,8 @@ struct clc_compile_args {
     * extension if NULL.
     */
    const char * const *allowed_spirv_extensions;
+
+   unsigned address_bits;
 };
 
 struct clc_binary {
index b89601e..5827d06 100644 (file)
@@ -764,9 +764,11 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
                                        &c->getDiagnosticOpts())
    };
 
+   const char *triple = args->address_bits == 32 ? "spir-unknown-unknown" : "spir64-unknown-unknown";
+
    std::vector<const char *> clang_opts = {
       args->source.name,
-      "-triple", "spir64-unknown-unknown",
+      "-triple", triple,
       // By default, clang prefers to use modules to pull in the default headers,
       // which doesn't work with our technique of embedding the headers in our binary
 #if LLVM_VERSION_MAJOR >= 15
index 721de8e..63963ca 100644 (file)
@@ -96,6 +96,7 @@ impl SPIRVBin {
             spirv_version: clc_spirv_version::CLC_SPIRV_VERSION_MAX,
             features: features,
             allowed_spirv_extensions: ptr::null(),
+            address_bits: 64,
         };
         let mut msgs: Vec<String> = Vec::new();
         let logger = clc_logger {