]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add riscv_vector target check
authorKito Cheng <kito.cheng@sifive.com>
Wed, 22 Mar 2023 10:47:52 +0000 (18:47 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 23 Mar 2023 03:14:12 +0000 (11:14 +0800)
Add target check funciton to ensure vector extension can be used.

gcc/testsuite/ChangeLog:

* lib/target-supports.exp (check_effective_target_riscv_vector):
New.

gcc/testsuite/lib/target-supports.exp

index 5e4a73af0de3350888d66239c5d59a452afa9fa4..932aa5b2d6677a7ffa249c49322f21c22538c039 100644 (file)
@@ -1759,6 +1759,18 @@ proc check_linker_plugin_available { } {
   } "-flto -fuse-linker-plugin"]
 }
 
+# Return 1 if the target has RISC-V vector extension, 0 otherwise.
+# Cache the result.
+
+proc check_effective_target_riscv_vector { } {
+    # Check that we are compiling for v by checking the __riscv_v marco.
+    return [check_no_compiler_messages riscv_vector assembly {
+       #if !defined(__riscv_v)
+       #error "__riscv_v not defined!"
+       #endif
+    }]
+}
+
 # Return 1 if the target is RV32, 0 otherwise.  Cache the result.
 
 proc check_effective_target_rv32 { } {