# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 # NOTE: This MIR test is required because the support for 64 bit memory ops is missing in X86 mode, Due to distinction between float/int types, support is expected in near future and there is this RFC in place https://discourse.llvm.org/t/rfc-globalisel-adding-fp-type-information-to-llt/83349. Once this support is introduced this test must be dropped and integrated into the LLVM IR tests. # RUN: llc -O2 -mtriple=i686-linux-gnu -mattr=+x87,-sse,-sse2 -run-pass=regbankselect,instruction-select -disable-gisel-legality-check -global-isel -verify-machineinstrs %s -o - | FileCheck %s --check-prefixes GISEL-X86 --- name: test_double_to_int16 alignment: 16 exposesReturnsTwice: false legalized: true tracksRegLiveness: true fixedStack: - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default, isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } stack: - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2, stack-id: default, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } body: | bb.1.entry: ; GISEL-X86-LABEL: name: test_double_to_int16 ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF ; GISEL-X86-NEXT: FP64_TO_INT16_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s16) into %stack.0) ; GISEL-X86-NEXT: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %stack.0, 1, $noreg, 0, $noreg :: (load (s16) from %stack.0) ; GISEL-X86-NEXT: $ax = COPY [[MOV16rm]] ; GISEL-X86-NEXT: RET 0, implicit $ax %0:_(s64) = IMPLICIT_DEF %3:_(p0) = G_FRAME_INDEX %stack.0 G_FIST %0(s64), %3(p0) :: (store (s16) into %stack.0) %2:_(s16) = G_LOAD %3(p0) :: (load (s16) from %stack.0) $ax = COPY %2(s16) RET 0, implicit $ax ... --- name: test_double_to_int32 alignment: 16 exposesReturnsTwice: false legalized: true tracksRegLiveness: true fixedStack: - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default, isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } stack: - { id: 0, name: '', type: default, offset: 0, size: 4, alignment: 4, stack-id: default, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } body: | bb.1.entry: ; GISEL-X86-LABEL: name: test_double_to_int32 ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF ; GISEL-X86-NEXT: FP64_TO_INT32_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s32) into %stack.0) ; GISEL-X86-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %stack.0) ; GISEL-X86-NEXT: $eax = COPY [[MOV32rm]] ; GISEL-X86-NEXT: RET 0, implicit $eax %0:_(s64) = IMPLICIT_DEF %3:_(p0) = G_FRAME_INDEX %stack.0 G_FIST %0(s64), %3(p0) :: (store (s32) into %stack.0) %2:_(s32) = G_LOAD %3(p0) :: (load (s32) from %stack.0) $eax = COPY %2(s32) RET 0, implicit $eax ... --- name: test_double_to_int64 alignment: 16 exposesReturnsTwice: false legalized: true tracksRegLiveness: true fixedStack: - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default, isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } stack: - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 8, stack-id: default, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } body: | bb.1.entry: ; GISEL-X86-LABEL: name: test_double_to_int64 ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF ; GISEL-X86-NEXT: [[LEA32r:%[0-9]+]]:gr32 = LEA32r %stack.0, 1, $noreg, 0, $noreg ; GISEL-X86-NEXT: FP64_TO_INT64_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s64) into %stack.0) ; GISEL-X86-NEXT: [[MOV32rm:%[0-9]+]]:gr32 = MOV32rm %stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %stack.0, align 8) ; GISEL-X86-NEXT: [[MOV32rm1:%[0-9]+]]:gr32 = MOV32rm [[LEA32r]], 1, $noreg, 4, $noreg :: (load (s32) from %stack.0 + 4, basealign 8) ; GISEL-X86-NEXT: $eax = COPY [[MOV32rm]] ; GISEL-X86-NEXT: $edx = COPY [[MOV32rm1]] ; GISEL-X86-NEXT: RET 0, implicit $eax, implicit $edx %1:_(p0) = G_FRAME_INDEX %fixed-stack.0 %10:_(s32) = G_LOAD %1(p0) :: (invariant load (s32) from %fixed-stack.0, align 16) %8:_(s32) = G_CONSTANT i32 4 %11:_(p0) = G_PTR_ADD %1, %8(s32) %12:_(s32) = G_LOAD %11(p0) :: (invariant load (s32) from %fixed-stack.0 + 4, basealign 16) %0:_(s64) = IMPLICIT_DEF %5:_(p0) = G_FRAME_INDEX %stack.0 G_FIST %0(s64), %5(p0) :: (store (s64) into %stack.0) %6:_(s32) = G_LOAD %5(p0) :: (load (s32) from %stack.0, align 8) %7:_(p0) = G_PTR_ADD %5, %8(s32) %9:_(s32) = G_LOAD %7(p0) :: (load (s32) from %stack.0 + 4, basealign 8) $eax = COPY %6(s32) $edx = COPY %9(s32) RET 0, implicit $eax, implicit $edx ... --- name: test_double_to_int8 alignment: 16 exposesReturnsTwice: false legalized: true tracksRegLiveness: true fixedStack: - { id: 0, type: default, offset: 0, size: 8, alignment: 16, stack-id: default, isImmutable: true, isAliased: false, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } stack: - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2, stack-id: default, callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } body: | bb.1.entry: ; GISEL-X86-LABEL: name: test_double_to_int8 ; GISEL-X86: [[DEF:%[0-9]+]]:rfp64 = IMPLICIT_DEF ; GISEL-X86-NEXT: FP64_TO_INT16_IN_MEM %stack.0, 1, $noreg, 0, $noreg, [[DEF]], implicit-def dead $eflags :: (store (s16) into %stack.0) ; GISEL-X86-NEXT: [[MOV16rm:%[0-9]+]]:gr16 = MOV16rm %stack.0, 1, $noreg, 0, $noreg :: (load (s16) from %stack.0) ; GISEL-X86-NEXT: [[COPY:%[0-9]+]]:gr16_abcd = COPY [[MOV16rm]] ; GISEL-X86-NEXT: [[COPY1:%[0-9]+]]:gr8_abcd_l = COPY [[COPY]].sub_8bit ; GISEL-X86-NEXT: $al = COPY [[COPY1]] ; GISEL-X86-NEXT: RET 0, implicit $al %0:_(s64) = IMPLICIT_DEF %4:_(p0) = G_FRAME_INDEX %stack.0 G_FIST %0(s64), %4(p0) :: (store (s16) into %stack.0) %3:_(s16) = G_LOAD %4(p0) :: (load (s16) from %stack.0) %2:_(s8) = G_TRUNC %3(s16) $al = COPY %2(s8) RET 0, implicit $al