x86_64-legalize-urem.mir 6.52 KB
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s

--- |
  ; ModuleID = 'urem.ll'
  source_filename = "urem.ll"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

  define i8 @test_urem_i8(i8 %arg1, i8 %arg2) {
    %res = urem i8 %arg1, %arg2
    ret i8 %res
  }

  define i16 @test_urem_i16(i16 %arg1, i16 %arg2) {
    %res = urem i16 %arg1, %arg2
    ret i16 %res
  }

  define i32 @test_urem_i32(i32 %arg1, i32 %arg2) {
    %res = urem i32 %arg1, %arg2
    ret i32 %res
  }

  define i64 @test_urem_i64(i64 %arg1, i64 %arg2) {
    %res = urem i64 %arg1, %arg2
    ret i64 %res
  }

...
---
name:            test_urem_i8
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
registers:
  - { id: 0, class: _, preferred-register: '' }
  - { id: 1, class: _, preferred-register: '' }
  - { id: 2, class: _, preferred-register: '' }
  - { id: 3, class: _, preferred-register: '' }
  - { id: 4, class: _, preferred-register: '' }
liveins:
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
constants:
body:             |
  bb.1 (%ir-block.0):
    liveins: $edi, $esi

    ; CHECK-LABEL: name: test_urem_i8
    ; CHECK: liveins: $edi, $esi
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
    ; CHECK: [[UREM:%[0-9]+]]:_(s8) = G_UREM [[TRUNC]], [[TRUNC1]]
    ; CHECK: $al = COPY [[UREM]](s8)
    ; CHECK: RET 0, implicit $al
    %2:_(s32) = COPY $edi
    %0:_(s8) = G_TRUNC %2(s32)
    %3:_(s32) = COPY $esi
    %1:_(s8) = G_TRUNC %3(s32)
    %4:_(s8) = G_UREM %0, %1
    $al = COPY %4(s8)
    RET 0, implicit $al

...
---
name:            test_urem_i16
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
registers:
  - { id: 0, class: _, preferred-register: '' }
  - { id: 1, class: _, preferred-register: '' }
  - { id: 2, class: _, preferred-register: '' }
  - { id: 3, class: _, preferred-register: '' }
  - { id: 4, class: _, preferred-register: '' }
liveins:
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
constants:
body:             |
  bb.1 (%ir-block.0):
    liveins: $edi, $esi

    ; CHECK-LABEL: name: test_urem_i16
    ; CHECK: liveins: $edi, $esi
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
    ; CHECK: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
    ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
    ; CHECK: [[UREM:%[0-9]+]]:_(s16) = G_UREM [[TRUNC]], [[TRUNC1]]
    ; CHECK: $ax = COPY [[UREM]](s16)
    ; CHECK: RET 0, implicit $ax
    %2:_(s32) = COPY $edi
    %0:_(s16) = G_TRUNC %2(s32)
    %3:_(s32) = COPY $esi
    %1:_(s16) = G_TRUNC %3(s32)
    %4:_(s16) = G_UREM %0, %1
    $ax = COPY %4(s16)
    RET 0, implicit $ax

...
---
name:            test_urem_i32
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
registers:
  - { id: 0, class: _, preferred-register: '' }
  - { id: 1, class: _, preferred-register: '' }
  - { id: 2, class: _, preferred-register: '' }
liveins:
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
constants:
body:             |
  bb.1 (%ir-block.0):
    liveins: $edi, $esi

    ; CHECK-LABEL: name: test_urem_i32
    ; CHECK: liveins: $edi, $esi
    ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
    ; CHECK: [[UREM:%[0-9]+]]:_(s32) = G_UREM [[COPY]], [[COPY1]]
    ; CHECK: $eax = COPY [[UREM]](s32)
    ; CHECK: RET 0, implicit $eax
    %0:_(s32) = COPY $edi
    %1:_(s32) = COPY $esi
    %2:_(s32) = G_UREM %0, %1
    $eax = COPY %2(s32)
    RET 0, implicit $eax

...
---
name:            test_urem_i64
alignment:       16
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
registers:
  - { id: 0, class: _, preferred-register: '' }
  - { id: 1, class: _, preferred-register: '' }
  - { id: 2, class: _, preferred-register: '' }
liveins:
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    0
  adjustsStack:    false
  hasCalls:        false
  stackProtector:  ''
  maxCallFrameSize: 4294967295
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
constants:
body:             |
  bb.1 (%ir-block.0):
    liveins: $rdi, $rsi

    ; CHECK-LABEL: name: test_urem_i64
    ; CHECK: liveins: $rdi, $rsi
    ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
    ; CHECK: [[UREM:%[0-9]+]]:_(s64) = G_UREM [[COPY]], [[COPY1]]
    ; CHECK: $rax = COPY [[UREM]](s64)
    ; CHECK: RET 0, implicit $rax
    %0:_(s64) = COPY $rdi
    %1:_(s64) = COPY $rsi
    %2:_(s64) = G_UREM %0, %1
    $rax = COPY %2(s64)
    RET 0, implicit $rax

...