Check avx2_available in check_avx2_available
[gcc.git] / gcc / testsuite / lib / target-supports.exp
index 5e5325550855c438115fcdb1096afb05630ab82f..90efaea804d34d480ad752ff07faaf85f71fd51b 100644 (file)
@@ -341,6 +341,9 @@ proc check_weak_available { } {
 # return 1 if weak undefined symbols are supported.
 
 proc check_effective_target_weak_undefined { } {
+    if { [istarget hppa*-*-hpux*] } {
+       return 0
+    }
     return [check_runtime weak_undefined {
        extern void foo () __attribute__((weak));
        int main (void) { if (foo) return 1; return 0; }
@@ -3785,6 +3788,43 @@ proc check_effective_target_arm_neon_fp16_ok { } {
                check_effective_target_arm_neon_fp16_ok_nocache]
 }
 
+# Return 1 if this is an ARM target supporting -mfpu=neon-fp16
+# and -mfloat-abi=softfp together.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_neon_softfp_fp16_flags to
+# the best options to add.
+
+proc check_effective_target_arm_neon_softfp_fp16_ok_nocache { } {
+    global et_arm_neon_softfp_fp16_flags
+    global et_arm_neon_flags
+    set et_arm_neon_softfp_fp16_flags ""
+    if { [check_effective_target_arm32]
+        && [check_effective_target_arm_neon_ok] } {
+       foreach flags {"-mfpu=neon-fp16 -mfloat-abi=softfp"
+                      "-mfpu=neon-fp16 -mfloat-abi=softfp -mfp16-format=ieee"} {
+           if { [check_no_compiler_messages_nocache arm_neon_softfp_fp16_ok object {
+               #include "arm_neon.h"
+               float16x4_t
+               foo (float32x4_t arg)
+               {
+                  return vcvt_f16_f32 (arg);
+               }
+           } "$et_arm_neon_flags $flags"] } {
+               set et_arm_neon_softfp_fp16_flags [concat $et_arm_neon_flags $flags]
+               return 1
+           }
+       }
+    }
+
+    return 0
+}
+
+proc check_effective_target_arm_neon_softfp_fp16_ok { } {
+    return [check_cached_effective_target arm_neon_softfp_fp16_ok \
+               check_effective_target_arm_neon_softfp_fp16_ok_nocache]
+}
+
+
+
 proc check_effective_target_arm_neon_fp16_hw { } {
     if {! [check_effective_target_arm_neon_fp16_ok] } {
        return 0
@@ -3808,6 +3848,14 @@ proc add_options_for_arm_neon_fp16 { flags } {
     return "$flags $et_arm_neon_fp16_flags"
 }
 
+proc add_options_for_arm_neon_softfp_fp16 { flags } {
+    if { ! [check_effective_target_arm_neon_softfp_fp16_ok] } {
+       return "$flags"
+    }
+    global et_arm_neon_softfp_fp16_flags
+    return "$flags $et_arm_neon_softfp_fp16_flags"
+}
+
 # Return 1 if this is an ARM target supporting the FP16 alternative
 # format.  Some multilibs may be incompatible with the options needed.  Also
 # set et_arm_neon_fp16_flags to the best options to add.
@@ -4522,7 +4570,7 @@ proc check_effective_target_arm_fp16fml_neon_ok_nocache { } {
                float32x2_t
                foo (float32x2_t r, float16x4_t a, float16x4_t b)
                {
-                 return vfmlal_high_u32 (r, a, b);
+                 return vfmlal_high_f16 (r, a, b);
                }
         } "$flags -march=armv8.2-a+fp16fml"] } {
             set et_arm_fp16fml_neon_flags "$flags -march=armv8.2-a+fp16fml"
@@ -6002,7 +6050,9 @@ proc check_effective_target_vect_usad_char { } {
       expr { [istarget i?86-*-*]
              || [istarget x86_64-*-*]
              || ([istarget aarch64*-*-*]
-                 && ![check_effective_target_aarch64_sve])}}]
+                 && ![check_effective_target_aarch64_sve])
+             || ([istarget powerpc*-*-*]
+                 && [check_p9vector_hw_available])}}]
 }
 
 # Return 1 if the target plus current options supports both signed
@@ -7353,7 +7403,7 @@ proc check_avx_available { } {
 # Return true if we are compiling for AVX2 target.
 
 proc check_avx2_available { } {
-  if { [check_no_compiler_messages avx_available assembly {
+  if { [check_no_compiler_messages avx2_available assembly {
     #ifndef __AVX2__
     #error unsupported
     #endif
@@ -8853,14 +8903,6 @@ proc check_effective_target_vect_max_reduc { } {
     return 0
 }
 
-# Return 1 if there is an nvptx offload compiler.
-
-proc check_effective_target_offload_nvptx { } {
-    return [check_no_compiler_messages offload_nvptx object {
-       int main () {return 0;}
-    } "-foffload=nvptx-none" ]
-}
-
 # Return 1 if the compiler has been configured with hsa offloading.
 
 proc check_effective_target_offload_hsa { } {