| 1 |
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py |
| 2 |
; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefix=PIC |
| 3 |
; RUN: llc -mtriple=x86_64-windows < %s | FileCheck %s --check-prefix=WIN |
| 4 |
|
| 5 |
define i64 @i64_test(i64 %i) nounwind readnone { |
| 6 |
; PIC-LABEL: i64_test: |
| 7 |
; PIC: # %bb.0: |
| 8 |
; PIC-NEXT: movq %rdi, %rax |
| 9 |
; PIC-NEXT: addq -{{[0-9]+}}(%rsp), %rax |
| 10 |
; PIC-NEXT: retq |
| 11 |
; |
| 12 |
; WIN-LABEL: i64_test: |
| 13 |
; WIN: # %bb.0: |
| 14 |
; WIN-NEXT: pushq %rax |
| 15 |
; WIN-NEXT: movq %rcx, %rax |
| 16 |
; WIN-NEXT: addq (%rsp), %rax |
| 17 |
; WIN-NEXT: popq %rcx |
| 18 |
; WIN-NEXT: retq |
| 19 |
%loc = alloca i64 |
| 20 |
%j = load i64, i64 * %loc |
| 21 |
%r = add i64 %i, %j |
| 22 |
ret i64 %r |
| 23 |
} |
| 24 |
|
| 25 |
define i64 @i32_test(i32 %i) nounwind readnone { |
| 26 |
; PIC-LABEL: i32_test: |
| 27 |
; PIC: # %bb.0: |
| 28 |
; PIC-NEXT: movl %edi, %eax |
| 29 |
; PIC-NEXT: addl -{{[0-9]+}}(%rsp), %eax |
| 30 |
; PIC-NEXT: retq |
| 31 |
; |
| 32 |
; WIN-LABEL: i32_test: |
| 33 |
; WIN: # %bb.0: |
| 34 |
; WIN-NEXT: pushq %rax |
| 35 |
; WIN-NEXT: movl %ecx, %eax |
| 36 |
; WIN-NEXT: addl {{[0-9]+}}(%rsp), %eax |
| 37 |
; WIN-NEXT: popq %rcx |
| 38 |
; WIN-NEXT: retq |
| 39 |
%loc = alloca i32 |
| 40 |
%j = load i32, i32 * %loc |
| 41 |
%r = add i32 %i, %j |
| 42 |
%ext = zext i32 %r to i64 |
| 43 |
ret i64 %ext |
| 44 |
} |
| 45 |
|
| 46 |
define i64 @i16_test(i16 %i) nounwind readnone { |
| 47 |
; PIC-LABEL: i16_test: |
| 48 |
; PIC: # %bb.0: |
| 49 |
; PIC-NEXT: addw -{{[0-9]+}}(%rsp), %di |
| 50 |
; PIC-NEXT: movzwl %di, %eax |
| 51 |
; PIC-NEXT: retq |
| 52 |
; |
| 53 |
; WIN-LABEL: i16_test: |
| 54 |
; WIN: # %bb.0: |
| 55 |
; WIN-NEXT: pushq %rax |
| 56 |
; WIN-NEXT: addw {{[0-9]+}}(%rsp), %cx |
| 57 |
; WIN-NEXT: movzwl %cx, %eax |
| 58 |
; WIN-NEXT: popq %rcx |
| 59 |
; WIN-NEXT: retq |
| 60 |
%loc = alloca i16 |
| 61 |
%j = load i16, i16 * %loc |
| 62 |
%r = add i16 %i, %j |
| 63 |
%ext = zext i16 %r to i64 |
| 64 |
ret i64 %ext |
| 65 |
} |
| 66 |
|
| 67 |
define i64 @i8_test(i8 %i) nounwind readnone { |
| 68 |
; PIC-LABEL: i8_test: |
| 69 |
; PIC: # %bb.0: |
| 70 |
; PIC-NEXT: addb -{{[0-9]+}}(%rsp), %dil |
| 71 |
; PIC-NEXT: movzbl %dil, %eax |
| 72 |
; PIC-NEXT: retq |
| 73 |
; |
| 74 |
; WIN-LABEL: i8_test: |
| 75 |
; WIN: # %bb.0: |
| 76 |
; WIN-NEXT: pushq %rax |
| 77 |
; WIN-NEXT: addb {{[0-9]+}}(%rsp), %cl |
| 78 |
; WIN-NEXT: movzbl %cl, %eax |
| 79 |
; WIN-NEXT: popq %rcx |
| 80 |
; WIN-NEXT: retq |
| 81 |
%loc = alloca i8 |
| 82 |
%j = load i8, i8 * %loc |
| 83 |
%r = add i8 %i, %j |
| 84 |
%ext = zext i8 %r to i64 |
| 85 |
ret i64 %ext |
| 86 |
} |