Skip to content

Commit c79de90

Browse files
committed
Precommit tests
1 parent 93c2eec commit c79de90

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

llvm/test/Transforms/VectorCombine/X86/bitop-of-castops.ll

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,19 @@ define <2 x i16> @and_bitcast_f32_to_v2i16_constant(float %a) {
433433
ret <2 x i16> %and
434434
}
435435

436+
define <2 x i16> @and_bitcast_f32_to_v2i16(float %a, float %b) {
437+
; CHECK-LABEL: @and_bitcast_f32_to_v2i16(
438+
; CHECK-NEXT: [[BC1:%.*]] = bitcast float [[A:%.*]] to <2 x i16>
439+
; CHECK-NEXT: [[BC2:%.*]] = bitcast float [[B:%.*]] to <2 x i16>
440+
; CHECK-NEXT: [[AND:%.*]] = and <2 x i16> [[BC1]], [[BC2]]
441+
; CHECK-NEXT: ret <2 x i16> [[AND]]
442+
;
443+
%bc1 = bitcast float %a to <2 x i16>
444+
%bc2 = bitcast float %b to <2 x i16>
445+
%and = and <2 x i16> %bc1, %bc2
446+
ret <2 x i16> %and
447+
}
448+
436449
; Negative test: bitcast from vector float to scalar int (optimization should not apply)
437450
define i64 @and_bitcast_v2f32_to_i64_constant(<2 x float> %a) {
438451
; CHECK-LABEL: @and_bitcast_v2f32_to_i64_constant(
@@ -445,6 +458,19 @@ define i64 @and_bitcast_v2f32_to_i64_constant(<2 x float> %a) {
445458
ret i64 %and
446459
}
447460

461+
define i64 @and_bitcast_v2f32_to_i64(<2 x float> %a, <2 x float> %b) {
462+
; CHECK-LABEL: @and_bitcast_v2f32_to_i64(
463+
; CHECK-NEXT: [[BC1:%.*]] = bitcast <2 x float> [[A:%.*]] to i64
464+
; CHECK-NEXT: [[BC2:%.*]] = bitcast <2 x float> [[B:%.*]] to i64
465+
; CHECK-NEXT: [[AND:%.*]] = and i64 [[BC1]], [[BC2]]
466+
; CHECK-NEXT: ret i64 [[AND]]
467+
;
468+
%bc1 = bitcast <2 x float> %a to i64
469+
%bc2 = bitcast <2 x float> %b to i64
470+
%and = and i64 %bc1, %bc2
471+
ret i64 %and
472+
}
473+
448474
; Test no-op bitcast
449475
define i16 @xor_bitcast_i16_to_i16_constant(i16 %a) {
450476
; CHECK-LABEL: @xor_bitcast_i16_to_i16_constant(
@@ -457,6 +483,19 @@ define i16 @xor_bitcast_i16_to_i16_constant(i16 %a) {
457483
ret i16 %or
458484
}
459485

486+
define i16 @xor_bitcast_i16_to_i16(i16 %a, i16 %b) {
487+
; CHECK-LABEL: @xor_bitcast_i16_to_i16(
488+
; CHECK-NEXT: [[BC1:%.*]] = bitcast i16 [[A:%.*]] to i16
489+
; CHECK-NEXT: [[BC2:%.*]] = bitcast i16 [[B:%.*]] to i16
490+
; CHECK-NEXT: [[OR:%.*]] = xor i16 [[BC1]], [[BC2]]
491+
; CHECK-NEXT: ret i16 [[OR]]
492+
;
493+
%bc1 = bitcast i16 %a to i16
494+
%bc2 = bitcast i16 %b to i16
495+
%or = xor i16 %bc1, %bc2
496+
ret i16 %or
497+
}
498+
460499
; Test bitwise operations with integer vector to integer bitcast
461500
define <16 x i1> @xor_bitcast_i16_to_v16i1_constant(i16 %a) {
462501
; CHECK-LABEL: @xor_bitcast_i16_to_v16i1_constant(
@@ -469,6 +508,19 @@ define <16 x i1> @xor_bitcast_i16_to_v16i1_constant(i16 %a) {
469508
ret <16 x i1> %or
470509
}
471510

511+
define <16 x i1> @xor_bitcast_i16_to_v16i1(i16 %a, i16 %b) {
512+
; CHECK-LABEL: @xor_bitcast_i16_to_v16i1(
513+
; CHECK-NEXT: [[BC1:%.*]] = bitcast i16 [[A:%.*]] to <16 x i1>
514+
; CHECK-NEXT: [[BC2:%.*]] = bitcast i16 [[B:%.*]] to <16 x i1>
515+
; CHECK-NEXT: [[OR:%.*]] = xor <16 x i1> [[BC1]], [[BC2]]
516+
; CHECK-NEXT: ret <16 x i1> [[OR]]
517+
;
518+
%bc1 = bitcast i16 %a to <16 x i1>
519+
%bc2 = bitcast i16 %b to <16 x i1>
520+
%or = xor <16 x i1> %bc1, %bc2
521+
ret <16 x i1> %or
522+
}
523+
472524
; Test bitwise operations with integer vector to integer bitcast
473525
define i16 @or_bitcast_v16i1_to_i16_constant(<16 x i1> %a) {
474526
; CHECK-LABEL: @or_bitcast_v16i1_to_i16_constant(
@@ -480,3 +532,16 @@ define i16 @or_bitcast_v16i1_to_i16_constant(<16 x i1> %a) {
480532
%or = or i16 %bc, 3
481533
ret i16 %or
482534
}
535+
536+
define i16 @or_bitcast_v16i1_to_i16(<16 x i1> %a, <16 x i1> %b) {
537+
; CHECK-LABEL: @or_bitcast_v16i1_to_i16(
538+
; CHECK-NEXT: [[BC1:%.*]] = bitcast <16 x i1> [[A:%.*]] to i16
539+
; CHECK-NEXT: [[BC2:%.*]] = bitcast <16 x i1> [[B:%.*]] to i16
540+
; CHECK-NEXT: [[OR:%.*]] = or i16 [[BC1]], [[BC2]]
541+
; CHECK-NEXT: ret i16 [[OR]]
542+
;
543+
%bc1 = bitcast <16 x i1> %a to i16
544+
%bc2 = bitcast <16 x i1> %b to i16
545+
%or = or i16 %bc1, %bc2
546+
ret i16 %or
547+
}

0 commit comments

Comments
 (0)