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
  138
  139
  140
  141
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=0 | \
; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWON %s
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -fixup-byte-word-insts=0 | \
; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWOFF %s
; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -fixup-byte-word-insts=1 | \
; RUN:   FileCheck -check-prefix=CHECK -check-prefix=BWON %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=0 | \
; RUN:   FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWOFF %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin -fixup-byte-word-insts=1 | \
; RUN:   FileCheck -check-prefix=DARWIN -check-prefix=DARWIN-BWON %s


@x = common global i32 0, align 4

define zeroext i1 @unsigned_i1() {
entry:
  %0 = load i32, i32* @x
  %cmp = icmp eq i32 %0, 42
  ret i1 %cmp

; Unsigned i1 return values are not extended.
; CHECK-LABEL: unsigned_i1:
; CHECK:			 cmp
; CHECK-NEXT:  sete
; CHECK-NEXT:  ret
}

define zeroext i8 @unsigned_i8() {
entry:
  %0 = load i32, i32* @x
  %cmp = icmp eq i32 %0, 42
  %retval = zext i1 %cmp to i8
  ret i8 %retval

; Unsigned i8 return values are not extended.
; CHECK-LABEL: unsigned_i8:
; CHECK:			 cmp
; CHECK-NEXT:  sete
; CHECK-NEXT:  ret

; Except on Darwin, for legacy reasons.
; DARWIN-LABEL: unsigned_i8:
; DARWIN:       xorl
; DARWIN-NEXT:  cmp
; DARWIN-NEXT:  sete
; DARWIN-NEXT:  ret
}

define signext i8 @signed_i8() {
entry:
  %0 = load i32, i32* @x
  %cmp = icmp eq i32 %0, 42
  %retval = zext i1 %cmp to i8
  ret i8 %retval

; Signed i8 return values are not extended.
; CHECK-LABEL: signed_i8:
; CHECK:			 cmp
; CHECK-NEXT:  sete
; CHECK-NEXT:  ret

; Except on Darwin, for legacy reasons.
; DARWIN-LABEL: signed_i8:
; DARWIN:       xorl
; DARWIN-NEXT:  cmp
; DARWIN-NEXT:  sete
; DARWIN-NEXT:  ret
}

@a = common global i16 0
@b = common global i16 0
define zeroext i16 @unsigned_i16() {
entry:
  %0 = load i16, i16* @a
  %1 = load i16, i16* @b
  %add = add i16 %1, %0
  ret i16 %add

; i16 return values are not extended.
; CHECK-LABEL: unsigned_i16:
; BWOFF:       movw
; BWON:        movzwl
; CHECK-NEXT:  addw
; CHECK-NEXT:  ret

; Except on Darwin, for legacy reasons.
; DARWIN-LABEL: unsigned_i16:
; DARWIN-BWOFF: movw
; DARWIN-BWON:  movzwl
; DARWIN-NEXT:  addw
; DARWIN-NEXT:  movzwl
; DARWIN-NEXT:  ret
}


define i32 @use_i1() {
entry:
  %0 = call i1 @unsigned_i1();
  %1 = zext i1 %0 to i32
  ret i32 %1

; The high 24 bits of %eax from a function returning i1 are undefined.
; CHECK-LABEL: use_i1:
; CHECK: call
; CHECK-NEXT: movzbl
; CHECK-NEXT: {{pop|add}}
; CHECK-NEXT: .cfi_def_cfa_offset {{4|8}}
; CHECK-NEXT: ret
}

define i32 @use_i8() {
entry:
  %0 = call i8 @unsigned_i8();
  %1 = zext i8 %0 to i32
  ret i32 %1

; The high 24 bits of %eax from a function returning i8 are undefined.
; CHECK-LABEL: use_i8:
; CHECK: call
; CHECK-NEXT: movzbl
; CHECK-NEXT: {{pop|add}}
; CHECK-NEXT: .cfi_def_cfa_offset {{4|8}}
; CHECK-NEXT: ret
}

define i32 @use_i16() {
entry:
  %0 = call i16 @unsigned_i16();
  %1 = zext i16 %0 to i32
  ret i32 %1

; The high 16 bits of %eax from a function returning i16 are undefined.
; CHECK-LABEL: use_i16:
; CHECK: call
; CHECK-NEXT: movzwl
; CHECK-NEXT: {{pop|add}}
; CHECK-NEXT: .cfi_def_cfa_offset {{4|8}}
; CHECK-NEXT: ret
}