391 }
392 }
393
394 @Test
395 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
396 IRNode.VECTOR_MASK_CMP_F, ">0",
397 IRNode.VECTOR_BLEND_F, ">0",
398 IRNode.STORE_VECTOR, ">0"},
399 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
400 private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
401 for (int i = 0; i < a.length; i++) {
402 c[i] = (a[i] != b[i]) ? 0.1f : -0.1f;
403 }
404 }
405
406 @Test
407 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
408 IRNode.VECTOR_MASK_CMP_F, ">0",
409 IRNode.VECTOR_BLEND_F, ">0",
410 IRNode.STORE_VECTOR, ">0"},
411 applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"},
412 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
413 private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) {
414 for (int i = 0; i < a.length; i+=2) {
415 c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f;
416 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
417 // With AlignVector, we need 8-byte alignment of vector loads/stores.
418 // UseCompactObjectHeaders=false UseCompactObjectHeaders=true
419 // adr = base + 16 + 8*i -> always adr = base + 12 + 8*i -> never
420 // -> vectorize -> no vectorization
421 }
422 }
423
424 @Test
425 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
426 IRNode.VECTOR_MASK_CMP_F, ">0",
427 IRNode.VECTOR_BLEND_F, ">0",
428 IRNode.STORE_VECTOR, ">0"},
429 applyIfOr = {"UseCompactObjectHeaders", "false", "AlignVector", "false"},
430 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
431 private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) {
432 for (int i = 0; i < a.length; i+=2) {
433 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
434 c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
435 // With AlignVector, we need 8-byte alignment of vector loads/stores.
436 // UseCompactObjectHeaders=false UseCompactObjectHeaders=true
437 // adr = base + 16 + 8*i -> always adr = base + 12 + 8*i -> never
438 // -> vectorize -> no vectorization
439 }
440 }
441
442 @Test
443 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
444 IRNode.VECTOR_MASK_CMP_F, "=0",
445 IRNode.VECTOR_BLEND_F, "=0",
446 IRNode.STORE_VECTOR, "=0"},
447 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
448 private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) {
449 for (int i = 0; i < a.length; i+=2) {
450 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
451 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
452 }
453 }
454
455 @Test
456 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
457 IRNode.VECTOR_MASK_CMP_F, "=0",
458 IRNode.VECTOR_BLEND_F, "=0",
|
391 }
392 }
393
394 @Test
395 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
396 IRNode.VECTOR_MASK_CMP_F, ">0",
397 IRNode.VECTOR_BLEND_F, ">0",
398 IRNode.STORE_VECTOR, ">0"},
399 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
400 private static void testCMoveFNEQforFConst(float[] a, float[] b, float[] c) {
401 for (int i = 0; i < a.length; i++) {
402 c[i] = (a[i] != b[i]) ? 0.1f : -0.1f;
403 }
404 }
405
406 @Test
407 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
408 IRNode.VECTOR_MASK_CMP_F, ">0",
409 IRNode.VECTOR_BLEND_F, ">0",
410 IRNode.STORE_VECTOR, ">0"},
411 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
412 private static void testCMoveFLTforFConstH2(float[] a, float[] b, float[] c) {
413 for (int i = 0; i < a.length; i+=2) {
414 c[i+0] = (a[i+0] < b[i+0]) ? 0.1f : -0.1f;
415 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
416 }
417 }
418
419 @Test
420 @IR(counts = {IRNode.LOAD_VECTOR_F, ">0",
421 IRNode.VECTOR_MASK_CMP_F, ">0",
422 IRNode.VECTOR_BLEND_F, ">0",
423 IRNode.STORE_VECTOR, ">0"},
424 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
425 private static void testCMoveFLEforFConstH2(float[] a, float[] b, float[] c) {
426 for (int i = 0; i < a.length; i+=2) {
427 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
428 c[i+1] = (a[i+1] <= b[i+1]) ? 0.1f : -0.1f;
429 }
430 }
431
432 @Test
433 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
434 IRNode.VECTOR_MASK_CMP_F, "=0",
435 IRNode.VECTOR_BLEND_F, "=0",
436 IRNode.STORE_VECTOR, "=0"},
437 applyIfCPUFeatureOr = {"avx", "true", "asimd", "true"})
438 private static void testCMoveFYYforFConstH2(float[] a, float[] b, float[] c) {
439 for (int i = 0; i < a.length; i+=2) {
440 c[i+0] = (a[i+0] <= b[i+0]) ? 0.1f : -0.1f;
441 c[i+1] = (a[i+1] < b[i+1]) ? 0.1f : -0.1f;
442 }
443 }
444
445 @Test
446 @IR(counts = {IRNode.LOAD_VECTOR_F, "=0",
447 IRNode.VECTOR_MASK_CMP_F, "=0",
448 IRNode.VECTOR_BLEND_F, "=0",
|