762 }
763 }
764
765 @Test
766 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
767 IRNode.VECTOR_MASK_CMP_F, ">0",
768 IRNode.VECTOR_BLEND_F, ">0",
769 IRNode.STORE_VECTOR, ">0"},
770 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
771 private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
772 for (int i = 0; i < a.length; i++) {
773 c[i] = (a[i] != b[i]) ? 0.1f : -0.1f;
774 }
775 }
776
777 @Test
778 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
779 IRNode.VECTOR_MASK_CMP_F, ">0",
780 IRNode.VECTOR_BLEND_F, ">0",
781 IRNode.STORE_VECTOR, ">0"},
782 applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"},
783 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
784 private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) {
785 for (int i = 0; i < a.length; i+=2) {
786 c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f;
787 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
788 // With AlignVector, we need 8-byte alignment of vector loads/stores.
789 // UseCompactObjectHeaders=false UseCompactObjectHeaders=true
790 // adr = base + 16 + 8*i -> always adr = base + 12 + 8*i -> never
791 // -> vectorize -> no vectorization
792 }
793 }
794
795 @Test
796 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
797 IRNode.VECTOR_MASK_CMP_F, ">0",
798 IRNode.VECTOR_BLEND_F, ">0",
799 IRNode.STORE_VECTOR, ">0"},
800 applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"},
801 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
802 private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) {
803 for (int i = 0; i < a.length; i+=2) {
804 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
805 c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
806 // With AlignVector, we need 8-byte alignment of vector loads/stores.
807 // UseCompactObjectHeaders=false UseCompactObjectHeaders=true
808 // adr = base + 16 + 8*i -> always adr = base + 12 + 8*i -> never
809 // -> vectorize -> no vectorization
810 }
811 }
812
813 @Test
814 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
815 IRNode.VECTOR_MASK_CMP_F, "=0",
816 IRNode.VECTOR_BLEND_F, "=0",
817 IRNode.STORE_VECTOR, "=0"},
818 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
819 private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) {
820 for (int i = 0; i < a.length; i+=2) {
821 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
822 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
823 }
824 }
825
826 @Test
827 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
828 IRNode.VECTOR_MASK_CMP_F, "=0",
829 IRNode.VECTOR_BLEND_F, "=0",
|
762 }
763 }
764
765 @Test
766 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
767 IRNode.VECTOR_MASK_CMP_F, ">0",
768 IRNode.VECTOR_BLEND_F, ">0",
769 IRNode.STORE_VECTOR, ">0"},
770 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
771 private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
772 for (int i = 0; i < a.length; i++) {
773 c[i] = (a[i] != b[i]) ? 0.1f : -0.1f;
774 }
775 }
776
777 @Test
778 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
779 IRNode.VECTOR_MASK_CMP_F, ">0",
780 IRNode.VECTOR_BLEND_F, ">0",
781 IRNode.STORE_VECTOR, ">0"},
782 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
783 private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) {
784 for (int i = 0; i < a.length; i+=2) {
785 c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f;
786 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
787 }
788 }
789
790 @Test
791 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
792 IRNode.VECTOR_MASK_CMP_F, ">0",
793 IRNode.VECTOR_BLEND_F, ">0",
794 IRNode.STORE_VECTOR, ">0"},
795 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
796 private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) {
797 for (int i = 0; i < a.length; i+=2) {
798 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
799 c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
800 }
801 }
802
803 @Test
804 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
805 IRNode.VECTOR_MASK_CMP_F, "=0",
806 IRNode.VECTOR_BLEND_F, "=0",
807 IRNode.STORE_VECTOR, "=0"},
808 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
809 private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) {
810 for (int i = 0; i < a.length; i+=2) {
811 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
812 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
813 }
814 }
815
816 @Test
817 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
818 IRNode.VECTOR_MASK_CMP_F, "=0",
819 IRNode.VECTOR_BLEND_F, "=0",
|