Index: clang/test/CodeGen/avx512f-builtins.c =================================================================== --- clang/test/CodeGen/avx512f-builtins.c +++ clang/test/CodeGen/avx512f-builtins.c @@ -1,5 +1,8 @@ -// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck %s -// RUN: %clang_cc1 -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck %s +// RUN: %clang_cc1 -fno-experimental-new-pass-manager -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Wall -Werror -disable-O0-optnone | opt -instsimplify -S | FileCheck %s +// RUN: %clang_cc1 -fno-experimental-new-pass-manager -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall -Werror -disable-O0-optnone | opt -instsimplify -S | FileCheck %s + +// RUN: %clang_cc1 -fexperimental-new-pass-manager -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -emit-llvm -o - -Wall -Werror -disable-O0-optnone | opt -instsimplify -S | FileCheck %s +// RUN: %clang_cc1 -fexperimental-new-pass-manager -fms-extensions -fms-compatibility -ffreestanding %s -triple=x86_64-windows-msvc -target-feature +avx512f -emit-llvm -o - -Wall -Werror -disable-O0-optnone | opt -instsimplify -S | FileCheck %s #include @@ -1399,7 +1402,7 @@ __mmask16 test_mm512_cmp_ps_mask_false_oq(__m512 a, __m512 b) { // CHECK-LABEL: test_mm512_cmp_ps_mask_false_oq - // CHECK: fcmp false <16 x float> %{{.*}}, %{{.*}} + // CHECK: ret i16 0 return _mm512_cmp_ps_mask(a, b, _CMP_FALSE_OQ); } @@ -1423,7 +1426,7 @@ __mmask16 test_mm512_cmp_ps_mask_true_uq(__m512 a, __m512 b) { // CHECK-LABEL: test_mm512_cmp_ps_mask_true_uq - // CHECK: fcmp true <16 x float> %{{.*}}, %{{.*}} + // CHECK: ret i16 -1 return _mm512_cmp_ps_mask(a, b, _CMP_TRUE_UQ); } @@ -1495,7 +1498,7 @@ __mmask16 test_mm512_cmp_ps_mask_false_os(__m512 a, __m512 b) { // CHECK-LABEL: test_mm512_cmp_ps_mask_false_os - // CHECK: fcmp false <16 x float> %{{.*}}, %{{.*}} + // CHECK: ret i16 0 return _mm512_cmp_ps_mask(a, b, _CMP_FALSE_OS); } @@ -1519,7 +1522,7 @@ __mmask16 test_mm512_cmp_ps_mask_true_us(__m512 a, __m512 b) { // CHECK-LABEL: test_mm512_cmp_ps_mask_true_us - // CHECK: fcmp true <16 x float> %{{.*}}, %{{.*}} + // CHECK: ret i16 -1 return _mm512_cmp_ps_mask(a, b, _CMP_TRUE_US); } @@ -1602,8 +1605,7 @@ __mmask16 test_mm512_mask_cmp_ps_mask_false_oq(__mmask16 m, __m512 a, __m512 b) { // CHECK-LABEL: test_mm512_mask_cmp_ps_mask_false_oq - // CHECK: [[CMP:%.*]] = fcmp false <16 x float> %{{.*}}, %{{.*}} - // CHECK: and <16 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_ps_mask(m, a, b, _CMP_FALSE_OQ); } @@ -1630,8 +1632,7 @@ __mmask16 test_mm512_mask_cmp_ps_mask_true_uq(__mmask16 m, __m512 a, __m512 b) { // CHECK-LABEL: test_mm512_mask_cmp_ps_mask_true_uq - // CHECK: [[CMP:%.*]] = fcmp true <16 x float> %{{.*}}, %{{.*}} - // CHECK: and <16 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_ps_mask(m, a, b, _CMP_TRUE_UQ); } @@ -1714,8 +1715,7 @@ __mmask16 test_mm512_mask_cmp_ps_mask_false_os(__mmask16 m, __m512 a, __m512 b) { // CHECK-LABEL: test_mm512_mask_cmp_ps_mask_false_os - // CHECK: [[CMP:%.*]] = fcmp false <16 x float> %{{.*}}, %{{.*}} - // CHECK: and <16 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_ps_mask(m, a, b, _CMP_FALSE_OS); } @@ -1742,8 +1742,7 @@ __mmask16 test_mm512_mask_cmp_ps_mask_true_us(__mmask16 m, __m512 a, __m512 b) { // CHECK-LABEL: test_mm512_mask_cmp_ps_mask_true_us - // CHECK: [[CMP:%.*]] = fcmp true <16 x float> %{{.*}}, %{{.*}} - // CHECK: and <16 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_ps_mask(m, a, b, _CMP_TRUE_US); } @@ -1828,7 +1827,7 @@ __mmask8 test_mm512_cmp_pd_mask_false_oq(__m512d a, __m512d b) { // CHECK-LABEL: test_mm512_cmp_pd_mask_false_oq - // CHECK: fcmp false <8 x double> %{{.*}}, %{{.*}} + // CHECK: ret i8 0 return _mm512_cmp_pd_mask(a, b, _CMP_FALSE_OQ); } @@ -1852,7 +1851,7 @@ __mmask8 test_mm512_cmp_pd_mask_true_uq(__m512d a, __m512d b) { // CHECK-LABEL: test_mm512_cmp_pd_mask_true_uq - // CHECK: fcmp true <8 x double> %{{.*}}, %{{.*}} + // CHECK: ret i8 -1 return _mm512_cmp_pd_mask(a, b, _CMP_TRUE_UQ); } @@ -1924,7 +1923,7 @@ __mmask8 test_mm512_cmp_pd_mask_false_os(__m512d a, __m512d b) { // CHECK-LABEL: test_mm512_cmp_pd_mask_false_os - // CHECK: fcmp false <8 x double> %{{.*}}, %{{.*}} + // CHECK: ret i8 0 return _mm512_cmp_pd_mask(a, b, _CMP_FALSE_OS); } @@ -1948,7 +1947,7 @@ __mmask8 test_mm512_cmp_pd_mask_true_us(__m512d a, __m512d b) { // CHECK-LABEL: test_mm512_cmp_pd_mask_true_us - // CHECK: fcmp true <8 x double> %{{.*}}, %{{.*}} + // CHECK: ret i8 -1 return _mm512_cmp_pd_mask(a, b, _CMP_TRUE_US); } @@ -2031,8 +2030,7 @@ __mmask8 test_mm512_mask_cmp_pd_mask_false_oq(__mmask8 m, __m512d a, __m512d b) { // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_false_oq - // CHECK: [[CMP:%.*]] = fcmp false <8 x double> %{{.*}}, %{{.*}} - // CHECK: and <8 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_FALSE_OQ); } @@ -2059,8 +2057,7 @@ __mmask8 test_mm512_mask_cmp_pd_mask_true_uq(__mmask8 m, __m512d a, __m512d b) { // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_true_uq - // CHECK: [[CMP:%.*]] = fcmp true <8 x double> %{{.*}}, %{{.*}} - // CHECK: and <8 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_TRUE_UQ); } @@ -2143,8 +2140,7 @@ __mmask8 test_mm512_mask_cmp_pd_mask_false_os(__mmask8 m, __m512d a, __m512d b) { // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_false_os - // CHECK: [[CMP:%.*]] = fcmp false <8 x double> %{{.*}}, %{{.*}} - // CHECK: and <8 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_FALSE_OS); } @@ -2171,8 +2167,7 @@ __mmask8 test_mm512_mask_cmp_pd_mask_true_us(__mmask8 m, __m512d a, __m512d b) { // CHECK-LABEL: test_mm512_mask_cmp_pd_mask_true_us - // CHECK: [[CMP:%.*]] = fcmp true <8 x double> %{{.*}}, %{{.*}} - // CHECK: and <8 x i1> [[CMP]], {{.*}} + // FIXME: How to test? return _mm512_mask_cmp_pd_mask(m, a, b, _CMP_TRUE_US); } @@ -8318,7 +8313,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = and <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kand(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8330,7 +8327,9 @@ // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[NOT:%.*]] = xor <16 x i1> [[LHS]], // CHECK: [[RES:%.*]] = and <16 x i1> [[NOT]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kandn(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8341,7 +8340,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = or <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kor(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8424,7 +8425,9 @@ // CHECK: [[LHS2:%.*]] = shufflevector <16 x i1> [[LHS]], <16 x i1> [[LHS]], <8 x i32> // CHECK: [[RHS2:%.*]] = shufflevector <16 x i1> [[RHS]], <16 x i1> [[RHS]], <8 x i32> // CHECK: [[CONCAT:%.*]] = shufflevector <8 x i1> [[RHS2]], <8 x i1> [[LHS2]], <16 x i32> - // CHECK: bitcast <16 x i1> [[CONCAT]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[CONCAT]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kunpackb(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8436,7 +8439,9 @@ // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[NOT:%.*]] = xor <16 x i1> [[LHS]], // CHECK: [[RES:%.*]] = xor <16 x i1> [[NOT]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kxnor(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8447,7 +8452,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = xor <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_mm512_kxor(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8466,7 +8473,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = and <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_kand_mask16(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8478,7 +8487,9 @@ // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[NOT:%.*]] = xor <16 x i1> [[LHS]], // CHECK: [[RES:%.*]] = and <16 x i1> [[NOT]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_kandn_mask16(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8489,7 +8500,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = or <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_kor_mask16(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8501,7 +8514,9 @@ // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[NOT:%.*]] = xor <16 x i1> [[LHS]], // CHECK: [[RES:%.*]] = xor <16 x i1> [[NOT]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_kxnor_mask16(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8512,7 +8527,9 @@ // CHECK: [[LHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RHS:%.*]] = bitcast i16 %{{.*}} to <16 x i1> // CHECK: [[RES:%.*]] = xor <16 x i1> [[LHS]], [[RHS]] - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %1, %3 + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] to i16 return _mm512_mask_cmpneq_epu32_mask(_kxor_mask16(_mm512_cmpneq_epu32_mask(__A, __B), _mm512_cmpneq_epu32_mask(__C, __D)), __E, __F); @@ -8520,24 +8537,28 @@ __mmask16 test_kshiftli_mask16(__m512i A, __m512i B, __m512i C, __m512i D) { // CHECK-LABEL: @test_kshiftli_mask16 - // CHECK: [[VAL:%.*]] = bitcast i16 %{{.*}} to <16 x i1> + // CHECK: [[VAL:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} // CHECK: [[RES:%.*]] = shufflevector <16 x i1> zeroinitializer, <16 x i1> [[VAL]], <16 x i32> - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] return _mm512_mask_cmpneq_epu32_mask(_kshiftli_mask16(_mm512_cmpneq_epu32_mask(A, B), 1), C, D); } __mmask16 test_kshiftri_mask16(__m512i A, __m512i B, __m512i C, __m512i D) { // CHECK-LABEL: @test_kshiftri_mask16 - // CHECK: [[VAL:%.*]] = bitcast i16 %{{.*}} to <16 x i1> + // CHECK: [[VAL:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} // CHECK: [[RES:%.*]] = shufflevector <16 x i1> [[VAL]], <16 x i1> zeroinitializer, <16 x i32> - // CHECK: bitcast <16 x i1> [[RES]] to i16 + // CHECK: [[MASK:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK: [[AND:%.*]] = and <16 x i1> [[MASK]], [[RES]] + // CHECK: bitcast <16 x i1> [[AND]] return _mm512_mask_cmpneq_epu32_mask(_kshiftri_mask16(_mm512_cmpneq_epu32_mask(A, B), 1), C, D); } unsigned int test_cvtmask16_u32(__m512i A, __m512i B) { // CHECK-LABEL: @test_cvtmask16_u32 - // CHECK: bitcast <16 x i1> %{{.*}} to i16 - // CHECK: bitcast i16 %{{.*}} to <16 x i1> + // CHECK [[CMP:%.*]] = icmp ne <16 x i32> %{{.*}}, %{{.*}} + // CHECK [[CAST:%.*]] = bitcast <16 x i1> [[CMP]] to i16 // CHECK: zext i16 %{{.*}} to i32 return _cvtmask16_u32(_mm512_cmpneq_epu32_mask(A, B)); }