llvm.org GIT mirror llvm / 26962fa
[X86] Add i8/i16 smulo/umulo test cases where the overflow indication is used by a mask. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350204 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 9 months ago
1 changed file(s) with 192 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
369369 ;
370370 ; Check the use of the overflow bit in combination with a branch instruction.
371371 ;
372 define zeroext i1 @smulobri32(i32 %v1, i32 %v2) {
373 ; SDAG-LABEL: smulobri32:
374 ; SDAG: ## %bb.0:
375 ; SDAG-NEXT: imull %esi, %edi
372 define zeroext i1 @smulobri8(i8 %v1, i8 %v2) {
373 ; SDAG-LABEL: smulobri8:
374 ; SDAG: ## %bb.0:
375 ; SDAG-NEXT: movl %edi, %eax
376 ; SDAG-NEXT: ## kill: def $al killed $al killed $eax
377 ; SDAG-NEXT: imulb %sil
376378 ; SDAG-NEXT: jo LBB15_1
377379 ; SDAG-NEXT: ## %bb.2: ## %continue
378380 ; SDAG-NEXT: movb $1, %al
381383 ; SDAG-NEXT: xorl %eax, %eax
382384 ; SDAG-NEXT: retq
383385 ;
384 ; FAST-LABEL: smulobri32:
385 ; FAST: ## %bb.0:
386 ; FAST-NEXT: imull %esi, %edi
387 ; FAST-NEXT: jo LBB15_1
386 ; FAST-LABEL: smulobri8:
387 ; FAST: ## %bb.0:
388 ; FAST-NEXT: movl %edi, %eax
389 ; FAST-NEXT: ## kill: def $al killed $al killed $eax
390 ; FAST-NEXT: imulb %sil
391 ; FAST-NEXT: seto %al
392 ; FAST-NEXT: testb $1, %al
393 ; FAST-NEXT: jne LBB15_1
388394 ; FAST-NEXT: ## %bb.2: ## %continue
389395 ; FAST-NEXT: movb $1, %al
390396 ; FAST-NEXT: andb $1, %al
391397 ; FAST-NEXT: movzbl %al, %eax
392398 ; FAST-NEXT: retq
393399 ; FAST-NEXT: LBB15_1: ## %overflow
400 ; FAST-NEXT: xorl %eax, %eax
401 ; FAST-NEXT: andb $1, %al
402 ; FAST-NEXT: movzbl %al, %eax
403 ; FAST-NEXT: retq
404 %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 %v1, i8 %v2)
405 %val = extractvalue {i8, i1} %t, 0
406 %obit = extractvalue {i8, i1} %t, 1
407 br i1 %obit, label %overflow, label %continue, !prof !0
408
409 overflow:
410 ret i1 false
411
412 continue:
413 ret i1 true
414 }
415
416 define zeroext i1 @smulobri16(i16 %v1, i16 %v2) {
417 ; SDAG-LABEL: smulobri16:
418 ; SDAG: ## %bb.0:
419 ; SDAG-NEXT: imulw %si, %di
420 ; SDAG-NEXT: jo LBB16_1
421 ; SDAG-NEXT: ## %bb.2: ## %continue
422 ; SDAG-NEXT: movb $1, %al
423 ; SDAG-NEXT: retq
424 ; SDAG-NEXT: LBB16_1: ## %overflow
425 ; SDAG-NEXT: xorl %eax, %eax
426 ; SDAG-NEXT: retq
427 ;
428 ; FAST-LABEL: smulobri16:
429 ; FAST: ## %bb.0:
430 ; FAST-NEXT: imulw %si, %di
431 ; FAST-NEXT: seto %al
432 ; FAST-NEXT: testb $1, %al
433 ; FAST-NEXT: jne LBB16_1
434 ; FAST-NEXT: ## %bb.2: ## %continue
435 ; FAST-NEXT: movb $1, %al
436 ; FAST-NEXT: andb $1, %al
437 ; FAST-NEXT: movzbl %al, %eax
438 ; FAST-NEXT: retq
439 ; FAST-NEXT: LBB16_1: ## %overflow
440 ; FAST-NEXT: xorl %eax, %eax
441 ; FAST-NEXT: andb $1, %al
442 ; FAST-NEXT: movzbl %al, %eax
443 ; FAST-NEXT: retq
444 %t = call {i16, i1} @llvm.smul.with.overflow.i16(i16 %v1, i16 %v2)
445 %val = extractvalue {i16, i1} %t, 0
446 %obit = extractvalue {i16, i1} %t, 1
447 br i1 %obit, label %overflow, label %continue, !prof !0
448
449 overflow:
450 ret i1 false
451
452 continue:
453 ret i1 true
454 }
455
456 define zeroext i1 @smulobri32(i32 %v1, i32 %v2) {
457 ; SDAG-LABEL: smulobri32:
458 ; SDAG: ## %bb.0:
459 ; SDAG-NEXT: imull %esi, %edi
460 ; SDAG-NEXT: jo LBB17_1
461 ; SDAG-NEXT: ## %bb.2: ## %continue
462 ; SDAG-NEXT: movb $1, %al
463 ; SDAG-NEXT: retq
464 ; SDAG-NEXT: LBB17_1: ## %overflow
465 ; SDAG-NEXT: xorl %eax, %eax
466 ; SDAG-NEXT: retq
467 ;
468 ; FAST-LABEL: smulobri32:
469 ; FAST: ## %bb.0:
470 ; FAST-NEXT: imull %esi, %edi
471 ; FAST-NEXT: jo LBB17_1
472 ; FAST-NEXT: ## %bb.2: ## %continue
473 ; FAST-NEXT: movb $1, %al
474 ; FAST-NEXT: andb $1, %al
475 ; FAST-NEXT: movzbl %al, %eax
476 ; FAST-NEXT: retq
477 ; FAST-NEXT: LBB17_1: ## %overflow
394478 ; FAST-NEXT: xorl %eax, %eax
395479 ; FAST-NEXT: andb $1, %al
396480 ; FAST-NEXT: movzbl %al, %eax
411495 ; SDAG-LABEL: smulobri64:
412496 ; SDAG: ## %bb.0:
413497 ; SDAG-NEXT: imulq %rsi, %rdi
414 ; SDAG-NEXT: jo LBB16_1
498 ; SDAG-NEXT: jo LBB18_1
415499 ; SDAG-NEXT: ## %bb.2: ## %continue
416500 ; SDAG-NEXT: movb $1, %al
417501 ; SDAG-NEXT: retq
418 ; SDAG-NEXT: LBB16_1: ## %overflow
502 ; SDAG-NEXT: LBB18_1: ## %overflow
419503 ; SDAG-NEXT: xorl %eax, %eax
420504 ; SDAG-NEXT: retq
421505 ;
422506 ; FAST-LABEL: smulobri64:
423507 ; FAST: ## %bb.0:
424508 ; FAST-NEXT: imulq %rsi, %rdi
425 ; FAST-NEXT: jo LBB16_1
509 ; FAST-NEXT: jo LBB18_1
426510 ; FAST-NEXT: ## %bb.2: ## %continue
427511 ; FAST-NEXT: movb $1, %al
428512 ; FAST-NEXT: andb $1, %al
429513 ; FAST-NEXT: movzbl %al, %eax
430514 ; FAST-NEXT: retq
431 ; FAST-NEXT: LBB16_1: ## %overflow
515 ; FAST-NEXT: LBB18_1: ## %overflow
432516 ; FAST-NEXT: xorl %eax, %eax
433517 ; FAST-NEXT: andb $1, %al
434518 ; FAST-NEXT: movzbl %al, %eax
445529 ret i1 true
446530 }
447531
532 define zeroext i1 @umulobri8(i8 %v1, i8 %v2) {
533 ; SDAG-LABEL: umulobri8:
534 ; SDAG: ## %bb.0:
535 ; SDAG-NEXT: movl %edi, %eax
536 ; SDAG-NEXT: ## kill: def $al killed $al killed $eax
537 ; SDAG-NEXT: mulb %sil
538 ; SDAG-NEXT: jo LBB19_1
539 ; SDAG-NEXT: ## %bb.2: ## %continue
540 ; SDAG-NEXT: movb $1, %al
541 ; SDAG-NEXT: retq
542 ; SDAG-NEXT: LBB19_1: ## %overflow
543 ; SDAG-NEXT: xorl %eax, %eax
544 ; SDAG-NEXT: retq
545 ;
546 ; FAST-LABEL: umulobri8:
547 ; FAST: ## %bb.0:
548 ; FAST-NEXT: movl %edi, %eax
549 ; FAST-NEXT: ## kill: def $al killed $al killed $eax
550 ; FAST-NEXT: mulb %sil
551 ; FAST-NEXT: seto %al
552 ; FAST-NEXT: testb $1, %al
553 ; FAST-NEXT: jne LBB19_1
554 ; FAST-NEXT: ## %bb.2: ## %continue
555 ; FAST-NEXT: movb $1, %al
556 ; FAST-NEXT: andb $1, %al
557 ; FAST-NEXT: movzbl %al, %eax
558 ; FAST-NEXT: retq
559 ; FAST-NEXT: LBB19_1: ## %overflow
560 ; FAST-NEXT: xorl %eax, %eax
561 ; FAST-NEXT: andb $1, %al
562 ; FAST-NEXT: movzbl %al, %eax
563 ; FAST-NEXT: retq
564 %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 %v1, i8 %v2)
565 %val = extractvalue {i8, i1} %t, 0
566 %obit = extractvalue {i8, i1} %t, 1
567 br i1 %obit, label %overflow, label %continue, !prof !0
568
569 overflow:
570 ret i1 false
571
572 continue:
573 ret i1 true
574 }
575
576 define zeroext i1 @umulobri16(i16 %v1, i16 %v2) {
577 ; SDAG-LABEL: umulobri16:
578 ; SDAG: ## %bb.0:
579 ; SDAG-NEXT: movl %edi, %eax
580 ; SDAG-NEXT: ## kill: def $ax killed $ax killed $eax
581 ; SDAG-NEXT: mulw %si
582 ; SDAG-NEXT: jo LBB20_1
583 ; SDAG-NEXT: ## %bb.2: ## %continue
584 ; SDAG-NEXT: movb $1, %al
585 ; SDAG-NEXT: retq
586 ; SDAG-NEXT: LBB20_1: ## %overflow
587 ; SDAG-NEXT: xorl %eax, %eax
588 ; SDAG-NEXT: retq
589 ;
590 ; FAST-LABEL: umulobri16:
591 ; FAST: ## %bb.0:
592 ; FAST-NEXT: movl %edi, %eax
593 ; FAST-NEXT: ## kill: def $ax killed $ax killed $eax
594 ; FAST-NEXT: mulw %si
595 ; FAST-NEXT: seto %al
596 ; FAST-NEXT: testb $1, %al
597 ; FAST-NEXT: jne LBB20_1
598 ; FAST-NEXT: ## %bb.2: ## %continue
599 ; FAST-NEXT: movb $1, %al
600 ; FAST-NEXT: andb $1, %al
601 ; FAST-NEXT: movzbl %al, %eax
602 ; FAST-NEXT: retq
603 ; FAST-NEXT: LBB20_1: ## %overflow
604 ; FAST-NEXT: xorl %eax, %eax
605 ; FAST-NEXT: andb $1, %al
606 ; FAST-NEXT: movzbl %al, %eax
607 ; FAST-NEXT: retq
608 %t = call {i16, i1} @llvm.umul.with.overflow.i16(i16 %v1, i16 %v2)
609 %val = extractvalue {i16, i1} %t, 0
610 %obit = extractvalue {i16, i1} %t, 1
611 br i1 %obit, label %overflow, label %continue, !prof !0
612
613 overflow:
614 ret i1 false
615
616 continue:
617 ret i1 true
618 }
619
448620 define zeroext i1 @umulobri32(i32 %v1, i32 %v2) {
449621 ; SDAG-LABEL: umulobri32:
450622 ; SDAG: ## %bb.0:
451623 ; SDAG-NEXT: movl %edi, %eax
452624 ; SDAG-NEXT: mull %esi
453 ; SDAG-NEXT: jo LBB17_1
625 ; SDAG-NEXT: jo LBB21_1
454626 ; SDAG-NEXT: ## %bb.2: ## %continue
455627 ; SDAG-NEXT: movb $1, %al
456628 ; SDAG-NEXT: retq
457 ; SDAG-NEXT: LBB17_1: ## %overflow
629 ; SDAG-NEXT: LBB21_1: ## %overflow
458630 ; SDAG-NEXT: xorl %eax, %eax
459631 ; SDAG-NEXT: retq
460632 ;
462634 ; FAST: ## %bb.0:
463635 ; FAST-NEXT: movl %edi, %eax
464636 ; FAST-NEXT: mull %esi
465 ; FAST-NEXT: jo LBB17_1
637 ; FAST-NEXT: jo LBB21_1
466638 ; FAST-NEXT: ## %bb.2: ## %continue
467639 ; FAST-NEXT: movb $1, %al
468640 ; FAST-NEXT: andb $1, %al
469641 ; FAST-NEXT: movzbl %al, %eax
470642 ; FAST-NEXT: retq
471 ; FAST-NEXT: LBB17_1: ## %overflow
643 ; FAST-NEXT: LBB21_1: ## %overflow
472644 ; FAST-NEXT: xorl %eax, %eax
473645 ; FAST-NEXT: andb $1, %al
474646 ; FAST-NEXT: movzbl %al, %eax
490662 ; SDAG: ## %bb.0:
491663 ; SDAG-NEXT: movq %rdi, %rax
492664 ; SDAG-NEXT: mulq %rsi
493 ; SDAG-NEXT: jo LBB18_1
665 ; SDAG-NEXT: jo LBB22_1
494666 ; SDAG-NEXT: ## %bb.2: ## %continue
495667 ; SDAG-NEXT: movb $1, %al
496668 ; SDAG-NEXT: retq
497 ; SDAG-NEXT: LBB18_1: ## %overflow
669 ; SDAG-NEXT: LBB22_1: ## %overflow
498670 ; SDAG-NEXT: xorl %eax, %eax
499671 ; SDAG-NEXT: retq
500672 ;
502674 ; FAST: ## %bb.0:
503675 ; FAST-NEXT: movq %rdi, %rax
504676 ; FAST-NEXT: mulq %rsi
505 ; FAST-NEXT: jo LBB18_1
677 ; FAST-NEXT: jo LBB22_1
506678 ; FAST-NEXT: ## %bb.2: ## %continue
507679 ; FAST-NEXT: movb $1, %al
508680 ; FAST-NEXT: andb $1, %al
509681 ; FAST-NEXT: movzbl %al, %eax
510682 ; FAST-NEXT: retq
511 ; FAST-NEXT: LBB18_1: ## %overflow
683 ; FAST-NEXT: LBB22_1: ## %overflow
512684 ; FAST-NEXT: xorl %eax, %eax
513685 ; FAST-NEXT: andb $1, %al
514686 ; FAST-NEXT: movzbl %al, %eax