reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=+sse \
; RUN:     -enable-legalize-types-checking | FileCheck %s --check-prefix=SSE
; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=+sse \
; RUN:     -enable-legalize-types-checking | FileCheck %s --check-prefix=SSE
; RUN: llc < %s -O2 -mtriple=x86_64-linux-android -mattr=-sse \
; RUN:     -enable-legalize-types-checking | FileCheck %s --check-prefix=NOSSE
; RUN: llc < %s -O2 -mtriple=x86_64-linux-gnu -mattr=-sse \
; RUN:     -enable-legalize-types-checking | FileCheck %s --check-prefix=NOSSE

define void @test_select(fp128* %p, fp128* %q, i1 zeroext %c) {
; SSE-LABEL: test_select:
; SSE:       # %bb.0:
; SSE-NEXT:    testl %edx, %edx
; SSE-NEXT:    jne .LBB0_1
; SSE-NEXT:  # %bb.2:
; SSE-NEXT:    movaps {{.*}}(%rip), %xmm0
; SSE-NEXT:    movaps %xmm0, (%rsi)
; SSE-NEXT:    retq
; SSE-NEXT:  .LBB0_1:
; SSE-NEXT:    movups (%rdi), %xmm0
; SSE-NEXT:    movaps %xmm0, (%rsi)
; SSE-NEXT:    retq
;
; NOSSE-LABEL: test_select:
; NOSSE:       # %bb.0:
; NOSSE-NEXT:    xorl %eax, %eax
; NOSSE-NEXT:    testl %edx, %edx
; NOSSE-NEXT:    cmovneq (%rdi), %rax
; NOSSE-NEXT:    movabsq $9223231299366420480, %rcx # imm = 0x7FFF800000000000
; NOSSE-NEXT:    cmovneq 8(%rdi), %rcx
; NOSSE-NEXT:    movq %rcx, 8(%rsi)
; NOSSE-NEXT:    movq %rax, (%rsi)
; NOSSE-NEXT:    retq
  %a = load fp128, fp128* %p, align 2
  %r = select i1 %c, fp128 %a, fp128 0xL00000000000000007FFF800000000000
  store fp128 %r, fp128* %q
  ret void
}

; The uitofp will become a select_cc. This used to crash during type
; legalization because we didn't expect the operands to need to be softened.
define fp128 @test_select_cc(fp128, fp128) {
; SSE-LABEL: test_select_cc:
; SSE:       # %bb.0: # %BB0
; SSE-NEXT:    pushq %rbx
; SSE-NEXT:    .cfi_def_cfa_offset 16
; SSE-NEXT:    subq $32, %rsp
; SSE-NEXT:    .cfi_def_cfa_offset 48
; SSE-NEXT:    .cfi_offset %rbx, -16
; SSE-NEXT:    movaps %xmm1, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
; SSE-NEXT:    movaps %xmm0, (%rsp) # 16-byte Spill
; SSE-NEXT:    callq __netf2
; SSE-NEXT:    movl %eax, %ebx
; SSE-NEXT:    movaps (%rsp), %xmm0 # 16-byte Reload
; SSE-NEXT:    movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
; SSE-NEXT:    callq __eqtf2
; SSE-NEXT:    testl %eax, %eax
; SSE-NEXT:    je .LBB1_1
; SSE-NEXT:  # %bb.2: # %BB0
; SSE-NEXT:    xorps %xmm1, %xmm1
; SSE-NEXT:    jmp .LBB1_3
; SSE-NEXT:  .LBB1_1:
; SSE-NEXT:    movaps {{.*}}(%rip), %xmm1
; SSE-NEXT:  .LBB1_3: # %BB0
; SSE-NEXT:    testl %ebx, %ebx
; SSE-NEXT:    movaps (%rsp), %xmm0 # 16-byte Reload
; SSE-NEXT:    jne .LBB1_5
; SSE-NEXT:  # %bb.4: # %BB1
; SSE-NEXT:    movaps %xmm1, %xmm0
; SSE-NEXT:  .LBB1_5: # %BB2
; SSE-NEXT:    addq $32, %rsp
; SSE-NEXT:    .cfi_def_cfa_offset 16
; SSE-NEXT:    popq %rbx
; SSE-NEXT:    .cfi_def_cfa_offset 8
; SSE-NEXT:    retq
;
; NOSSE-LABEL: test_select_cc:
; NOSSE:       # %bb.0: # %BB0
; NOSSE-NEXT:    pushq %rbp
; NOSSE-NEXT:    .cfi_def_cfa_offset 16
; NOSSE-NEXT:    pushq %r15
; NOSSE-NEXT:    .cfi_def_cfa_offset 24
; NOSSE-NEXT:    pushq %r14
; NOSSE-NEXT:    .cfi_def_cfa_offset 32
; NOSSE-NEXT:    pushq %r12
; NOSSE-NEXT:    .cfi_def_cfa_offset 40
; NOSSE-NEXT:    pushq %rbx
; NOSSE-NEXT:    .cfi_def_cfa_offset 48
; NOSSE-NEXT:    .cfi_offset %rbx, -48
; NOSSE-NEXT:    .cfi_offset %r12, -40
; NOSSE-NEXT:    .cfi_offset %r14, -32
; NOSSE-NEXT:    .cfi_offset %r15, -24
; NOSSE-NEXT:    .cfi_offset %rbp, -16
; NOSSE-NEXT:    movq %rcx, %r12
; NOSSE-NEXT:    movq %rdx, %rbx
; NOSSE-NEXT:    movq %rsi, %r14
; NOSSE-NEXT:    movq %rdi, %r15
; NOSSE-NEXT:    callq __netf2
; NOSSE-NEXT:    movl %eax, %ebp
; NOSSE-NEXT:    movq %r15, %rdi
; NOSSE-NEXT:    movq %r14, %rsi
; NOSSE-NEXT:    movq %rbx, %rdx
; NOSSE-NEXT:    movq %r12, %rcx
; NOSSE-NEXT:    callq __eqtf2
; NOSSE-NEXT:    movl %eax, %ecx
; NOSSE-NEXT:    xorl %eax, %eax
; NOSSE-NEXT:    testl %ecx, %ecx
; NOSSE-NEXT:    movabsq $4611404543450677248, %rdx # imm = 0x3FFF000000000000
; NOSSE-NEXT:    cmovneq %rax, %rdx
; NOSSE-NEXT:    testl %ebp, %ebp
; NOSSE-NEXT:    je .LBB1_2
; NOSSE-NEXT:  # %bb.1:
; NOSSE-NEXT:    movq %r15, %rax
; NOSSE-NEXT:    movq %r14, %rdx
; NOSSE-NEXT:  .LBB1_2: # %BB2
; NOSSE-NEXT:    popq %rbx
; NOSSE-NEXT:    .cfi_def_cfa_offset 40
; NOSSE-NEXT:    popq %r12
; NOSSE-NEXT:    .cfi_def_cfa_offset 32
; NOSSE-NEXT:    popq %r14
; NOSSE-NEXT:    .cfi_def_cfa_offset 24
; NOSSE-NEXT:    popq %r15
; NOSSE-NEXT:    .cfi_def_cfa_offset 16
; NOSSE-NEXT:    popq %rbp
; NOSSE-NEXT:    .cfi_def_cfa_offset 8
; NOSSE-NEXT:    retq
BB0:
  %a = fcmp oeq fp128 %0, %1
  %b = uitofp i1 %a to fp128
  br i1 %a, label %BB1, label %BB2
BB1:
  br label %BB2
BB2:
  %c = phi fp128 [ %0, %BB0 ], [ %b, %BB1 ]
  ret fp128 %c
}