260 lines
8.6 KiB
LLVM
260 lines
8.6 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=sparc-unknown-linux-gnu | FileCheck %s --check-prefixes=SPARC
|
|
; RUN: llc < %s -mtriple=sparc64-unknown-linux-gnu | FileCheck %s --check-prefixes=SPARC64
|
|
|
|
define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
|
|
; SPARC-LABEL: muloti_test:
|
|
; SPARC: .cfi_startproc
|
|
; SPARC-NEXT: ! %bb.0: ! %start
|
|
; SPARC-NEXT: save %sp, -128, %sp
|
|
; SPARC-NEXT: .cfi_def_cfa_register %fp
|
|
; SPARC-NEXT: .cfi_window_save
|
|
; SPARC-NEXT: .cfi_register %o7, %i7
|
|
; SPARC-NEXT: ld [%fp+92], %l3
|
|
; SPARC-NEXT: ld [%fp+96], %g2
|
|
; SPARC-NEXT: umul %i2, %i5, %g3
|
|
; SPARC-NEXT: rd %y, %g4
|
|
; SPARC-NEXT: st %g4, [%fp+-20] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: umul %i4, %i3, %g4
|
|
; SPARC-NEXT: rd %y, %l0
|
|
; SPARC-NEXT: st %l0, [%fp+-24] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: st %g2, [%sp+96]
|
|
; SPARC-NEXT: st %i5, [%fp+-8] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: umul %i5, %i3, %l0
|
|
; SPARC-NEXT: rd %y, %l5
|
|
; SPARC-NEXT: st %l3, [%sp+92]
|
|
; SPARC-NEXT: umul %l3, %i1, %l4
|
|
; SPARC-NEXT: rd %y, %i5
|
|
; SPARC-NEXT: st %i5, [%fp+-12] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: add %g4, %g3, %l2
|
|
; SPARC-NEXT: mov %i0, %i5
|
|
; SPARC-NEXT: umul %i0, %g2, %g3
|
|
; SPARC-NEXT: rd %y, %i0
|
|
; SPARC-NEXT: st %i0, [%fp+-16] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: add %l5, %l2, %l1
|
|
; SPARC-NEXT: st %i1, [%fp+-4] ! 4-byte Folded Spill
|
|
; SPARC-NEXT: umul %i1, %g2, %g2
|
|
; SPARC-NEXT: rd %y, %l6
|
|
; SPARC-NEXT: add %g3, %l4, %i0
|
|
; SPARC-NEXT: add %l6, %i0, %l7
|
|
; SPARC-NEXT: addcc %g2, %l0, %l4
|
|
; SPARC-NEXT: mov %g0, %l0
|
|
; SPARC-NEXT: addxcc %l7, %l1, %i1
|
|
; SPARC-NEXT: mov %l0, %o0
|
|
; SPARC-NEXT: mov %l0, %o1
|
|
; SPARC-NEXT: mov %i2, %o2
|
|
; SPARC-NEXT: mov %i3, %o3
|
|
; SPARC-NEXT: mov %l0, %o4
|
|
; SPARC-NEXT: call __multi3
|
|
; SPARC-NEXT: mov %l0, %o5
|
|
; SPARC-NEXT: addcc %o1, %l4, %i3
|
|
; SPARC-NEXT: addxcc %o0, %i1, %g2
|
|
; SPARC-NEXT: mov 1, %g3
|
|
; SPARC-NEXT: cmp %g2, %o0
|
|
; SPARC-NEXT: bcs .LBB0_2
|
|
; SPARC-NEXT: mov %g3, %g4
|
|
; SPARC-NEXT: ! %bb.1: ! %start
|
|
; SPARC-NEXT: mov %l0, %g4
|
|
; SPARC-NEXT: .LBB0_2: ! %start
|
|
; SPARC-NEXT: cmp %i3, %o1
|
|
; SPARC-NEXT: bcs .LBB0_4
|
|
; SPARC-NEXT: mov %g3, %o4
|
|
; SPARC-NEXT: ! %bb.3: ! %start
|
|
; SPARC-NEXT: mov %l0, %o4
|
|
; SPARC-NEXT: .LBB0_4: ! %start
|
|
; SPARC-NEXT: cmp %g2, %o0
|
|
; SPARC-NEXT: be .LBB0_6
|
|
; SPARC-NEXT: nop
|
|
; SPARC-NEXT: ! %bb.5: ! %start
|
|
; SPARC-NEXT: mov %g4, %o4
|
|
; SPARC-NEXT: .LBB0_6: ! %start
|
|
; SPARC-NEXT: xor %g2, %o0, %i1
|
|
; SPARC-NEXT: xor %i3, %o1, %g4
|
|
; SPARC-NEXT: or %g4, %i1, %i1
|
|
; SPARC-NEXT: cmp %i1, 0
|
|
; SPARC-NEXT: be .LBB0_8
|
|
; SPARC-NEXT: mov %l0, %g4
|
|
; SPARC-NEXT: ! %bb.7: ! %start
|
|
; SPARC-NEXT: mov %o4, %g4
|
|
; SPARC-NEXT: .LBB0_8: ! %start
|
|
; SPARC-NEXT: cmp %l1, %l5
|
|
; SPARC-NEXT: mov %g3, %l1
|
|
; SPARC-NEXT: bcs .LBB0_10
|
|
; SPARC-NEXT: mov %i5, %i1
|
|
; SPARC-NEXT: ! %bb.9: ! %start
|
|
; SPARC-NEXT: mov %l0, %l1
|
|
; SPARC-NEXT: .LBB0_10: ! %start
|
|
; SPARC-NEXT: cmp %l2, 0
|
|
; SPARC-NEXT: be .LBB0_12
|
|
; SPARC-NEXT: mov %l0, %o0
|
|
; SPARC-NEXT: ! %bb.11: ! %start
|
|
; SPARC-NEXT: mov %l1, %o0
|
|
; SPARC-NEXT: .LBB0_12: ! %start
|
|
; SPARC-NEXT: cmp %i2, 0
|
|
; SPARC-NEXT: bne .LBB0_14
|
|
; SPARC-NEXT: mov %g3, %i2
|
|
; SPARC-NEXT: ! %bb.13: ! %start
|
|
; SPARC-NEXT: mov %l0, %i2
|
|
; SPARC-NEXT: .LBB0_14: ! %start
|
|
; SPARC-NEXT: cmp %i4, 0
|
|
; SPARC-NEXT: bne .LBB0_16
|
|
; SPARC-NEXT: mov %g3, %o1
|
|
; SPARC-NEXT: ! %bb.15: ! %start
|
|
; SPARC-NEXT: mov %l0, %o1
|
|
; SPARC-NEXT: .LBB0_16: ! %start
|
|
; SPARC-NEXT: ld [%fp+-24], %i5 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: cmp %i5, 0
|
|
; SPARC-NEXT: bne .LBB0_18
|
|
; SPARC-NEXT: mov %g3, %l5
|
|
; SPARC-NEXT: ! %bb.17: ! %start
|
|
; SPARC-NEXT: mov %l0, %l5
|
|
; SPARC-NEXT: .LBB0_18: ! %start
|
|
; SPARC-NEXT: ld [%fp+-20], %i5 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: cmp %i5, 0
|
|
; SPARC-NEXT: bne .LBB0_20
|
|
; SPARC-NEXT: mov %g3, %l1
|
|
; SPARC-NEXT: ! %bb.19: ! %start
|
|
; SPARC-NEXT: mov %l0, %l1
|
|
; SPARC-NEXT: .LBB0_20: ! %start
|
|
; SPARC-NEXT: cmp %l7, %l6
|
|
; SPARC-NEXT: bcs .LBB0_22
|
|
; SPARC-NEXT: mov %g3, %l6
|
|
; SPARC-NEXT: ! %bb.21: ! %start
|
|
; SPARC-NEXT: mov %l0, %l6
|
|
; SPARC-NEXT: .LBB0_22: ! %start
|
|
; SPARC-NEXT: cmp %i0, 0
|
|
; SPARC-NEXT: be .LBB0_24
|
|
; SPARC-NEXT: mov %l0, %l2
|
|
; SPARC-NEXT: ! %bb.23: ! %start
|
|
; SPARC-NEXT: mov %l6, %l2
|
|
; SPARC-NEXT: .LBB0_24: ! %start
|
|
; SPARC-NEXT: cmp %l3, 0
|
|
; SPARC-NEXT: bne .LBB0_26
|
|
; SPARC-NEXT: mov %g3, %l3
|
|
; SPARC-NEXT: ! %bb.25: ! %start
|
|
; SPARC-NEXT: mov %l0, %l3
|
|
; SPARC-NEXT: .LBB0_26: ! %start
|
|
; SPARC-NEXT: cmp %i1, 0
|
|
; SPARC-NEXT: bne .LBB0_28
|
|
; SPARC-NEXT: mov %g3, %l4
|
|
; SPARC-NEXT: ! %bb.27: ! %start
|
|
; SPARC-NEXT: mov %l0, %l4
|
|
; SPARC-NEXT: .LBB0_28: ! %start
|
|
; SPARC-NEXT: and %o1, %i2, %i2
|
|
; SPARC-NEXT: ld [%fp+-16], %i0 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: cmp %i0, 0
|
|
; SPARC-NEXT: and %l4, %l3, %l4
|
|
; SPARC-NEXT: bne .LBB0_30
|
|
; SPARC-NEXT: mov %g3, %l6
|
|
; SPARC-NEXT: ! %bb.29: ! %start
|
|
; SPARC-NEXT: mov %l0, %l6
|
|
; SPARC-NEXT: .LBB0_30: ! %start
|
|
; SPARC-NEXT: or %i2, %l5, %l3
|
|
; SPARC-NEXT: ld [%fp+-12], %i0 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: cmp %i0, 0
|
|
; SPARC-NEXT: or %l4, %l6, %i2
|
|
; SPARC-NEXT: bne .LBB0_32
|
|
; SPARC-NEXT: mov %g3, %l4
|
|
; SPARC-NEXT: ! %bb.31: ! %start
|
|
; SPARC-NEXT: mov %l0, %l4
|
|
; SPARC-NEXT: .LBB0_32: ! %start
|
|
; SPARC-NEXT: or %l3, %l1, %l1
|
|
; SPARC-NEXT: ld [%fp+-8], %i0 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: or %i0, %i4, %i0
|
|
; SPARC-NEXT: cmp %i0, 0
|
|
; SPARC-NEXT: or %i2, %l4, %i5
|
|
; SPARC-NEXT: bne .LBB0_34
|
|
; SPARC-NEXT: mov %g3, %i2
|
|
; SPARC-NEXT: ! %bb.33: ! %start
|
|
; SPARC-NEXT: mov %l0, %i2
|
|
; SPARC-NEXT: .LBB0_34: ! %start
|
|
; SPARC-NEXT: or %l1, %o0, %i4
|
|
; SPARC-NEXT: ld [%fp+-4], %i0 ! 4-byte Folded Reload
|
|
; SPARC-NEXT: or %i0, %i1, %i0
|
|
; SPARC-NEXT: cmp %i0, 0
|
|
; SPARC-NEXT: bne .LBB0_36
|
|
; SPARC-NEXT: or %i5, %l2, %i0
|
|
; SPARC-NEXT: ! %bb.35: ! %start
|
|
; SPARC-NEXT: mov %l0, %g3
|
|
; SPARC-NEXT: .LBB0_36: ! %start
|
|
; SPARC-NEXT: and %g3, %i2, %i1
|
|
; SPARC-NEXT: or %i1, %i0, %i0
|
|
; SPARC-NEXT: or %i0, %i4, %i0
|
|
; SPARC-NEXT: or %i0, %g4, %i0
|
|
; SPARC-NEXT: and %i0, 1, %i4
|
|
; SPARC-NEXT: mov %g2, %i0
|
|
; SPARC-NEXT: mov %i3, %i1
|
|
; SPARC-NEXT: mov %o2, %i2
|
|
; SPARC-NEXT: ret
|
|
; SPARC-NEXT: restore %g0, %o3, %o3
|
|
;
|
|
; SPARC64-LABEL: muloti_test:
|
|
; SPARC64: .cfi_startproc
|
|
; SPARC64-NEXT: .register %g2, #scratch
|
|
; SPARC64-NEXT: ! %bb.0: ! %start
|
|
; SPARC64-NEXT: save %sp, -176, %sp
|
|
; SPARC64-NEXT: .cfi_def_cfa_register %fp
|
|
; SPARC64-NEXT: .cfi_window_save
|
|
; SPARC64-NEXT: .cfi_register %o7, %i7
|
|
; SPARC64-NEXT: srax %i2, 63, %o0
|
|
; SPARC64-NEXT: srax %i1, 63, %o2
|
|
; SPARC64-NEXT: mov %i2, %o1
|
|
; SPARC64-NEXT: call __multi3
|
|
; SPARC64-NEXT: mov %i1, %o3
|
|
; SPARC64-NEXT: mov %o0, %i4
|
|
; SPARC64-NEXT: mov %o1, %i5
|
|
; SPARC64-NEXT: srax %i0, 63, %o0
|
|
; SPARC64-NEXT: srax %i3, 63, %o2
|
|
; SPARC64-NEXT: mov %i0, %o1
|
|
; SPARC64-NEXT: call __multi3
|
|
; SPARC64-NEXT: mov %i3, %o3
|
|
; SPARC64-NEXT: mov %o0, %l0
|
|
; SPARC64-NEXT: add %o1, %i5, %i5
|
|
; SPARC64-NEXT: mov 0, %o0
|
|
; SPARC64-NEXT: mov %i1, %o1
|
|
; SPARC64-NEXT: mov %o0, %o2
|
|
; SPARC64-NEXT: call __multi3
|
|
; SPARC64-NEXT: mov %i3, %o3
|
|
; SPARC64-NEXT: add %o0, %i5, %i1
|
|
; SPARC64-NEXT: mov %g0, %i3
|
|
; SPARC64-NEXT: cmp %i1, %o0
|
|
; SPARC64-NEXT: mov %i3, %g2
|
|
; SPARC64-NEXT: movcs %xcc, 1, %g2
|
|
; SPARC64-NEXT: cmp %i5, 0
|
|
; SPARC64-NEXT: move %xcc, 0, %g2
|
|
; SPARC64-NEXT: cmp %i4, 0
|
|
; SPARC64-NEXT: mov %i3, %i4
|
|
; SPARC64-NEXT: movne %xcc, 1, %i4
|
|
; SPARC64-NEXT: cmp %l0, 0
|
|
; SPARC64-NEXT: mov %i3, %i5
|
|
; SPARC64-NEXT: movne %xcc, 1, %i5
|
|
; SPARC64-NEXT: cmp %i2, 0
|
|
; SPARC64-NEXT: mov %i3, %i2
|
|
; SPARC64-NEXT: movne %xcc, 1, %i2
|
|
; SPARC64-NEXT: cmp %i0, 0
|
|
; SPARC64-NEXT: movne %xcc, 1, %i3
|
|
; SPARC64-NEXT: and %i3, %i2, %i0
|
|
; SPARC64-NEXT: or %i0, %i5, %i0
|
|
; SPARC64-NEXT: or %i0, %i4, %i0
|
|
; SPARC64-NEXT: or %i0, %g2, %i0
|
|
; SPARC64-NEXT: srl %i0, 0, %i2
|
|
; SPARC64-NEXT: mov %i1, %i0
|
|
; SPARC64-NEXT: ret
|
|
; SPARC64-NEXT: restore %g0, %o1, %o1
|
|
start:
|
|
%0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
|
|
%1 = extractvalue { i128, i1 } %0, 0
|
|
%2 = extractvalue { i128, i1 } %0, 1
|
|
%3 = zext i1 %2 to i8
|
|
%4 = insertvalue { i128, i8 } undef, i128 %1, 0
|
|
%5 = insertvalue { i128, i8 } %4, i8 %3, 1
|
|
ret { i128, i8 } %5
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone speculatable
|
|
declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
|
|
|
|
attributes #0 = { nounwind readnone uwtable }
|
|
attributes #1 = { nounwind readnone speculatable }
|
|
attributes #2 = { nounwind }
|