forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[x86] add tests to show current memset codegen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264748 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
f504359
commit 65a7ad2
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
; NOTE: Assertions have been autogenerated by update_test_checks.py | ||
; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=sse2 | FileCheck %s --check-prefix=ANY --check-prefix=SSE2 | ||
; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx | FileCheck %s --check-prefix=ANY --check-prefix=AVX --check-prefix=AVX1 | ||
; RUN: llc -mtriple=x86_64-unknown-unknown < %s -mattr=avx2 | FileCheck %s --check-prefix=ANY --check-prefix=AVX --check-prefix=AVX2 | ||
|
||
define void @memset_16_nonzero_bytes(i8* %x) { | ||
; ANY-LABEL: memset_16_nonzero_bytes: | ||
; ANY: movabsq $3038287259199220266, %rax # imm = 0x2A2A2A2A2A2A2A2A | ||
; ANY-NEXT: movq %rax, 8(%rdi) | ||
; ANY-NEXT: movq %rax, (%rdi) | ||
; ANY-NEXT: retq | ||
; | ||
%call = tail call i8* @__memset_chk(i8* %x, i32 42, i64 16, i64 -1) | ||
ret void | ||
} | ||
|
||
define void @memset_32_nonzero_bytes(i8* %x) { | ||
; ANY-LABEL: memset_32_nonzero_bytes: | ||
; ANY: movabsq $3038287259199220266, %rax # imm = 0x2A2A2A2A2A2A2A2A | ||
; ANY-NEXT: movq %rax, 24(%rdi) | ||
; ANY-NEXT: movq %rax, 16(%rdi) | ||
; ANY-NEXT: movq %rax, 8(%rdi) | ||
; ANY-NEXT: movq %rax, (%rdi) | ||
; ANY-NEXT: retq | ||
; | ||
%call = tail call i8* @__memset_chk(i8* %x, i32 42, i64 32, i64 -1) | ||
ret void | ||
} | ||
|
||
define void @memset_64_nonzero_bytes(i8* %x) { | ||
; ANY-LABEL: memset_64_nonzero_bytes: | ||
; ANY: movabsq $3038287259199220266, %rax # imm = 0x2A2A2A2A2A2A2A2A | ||
; ANY-NEXT: movq %rax, 56(%rdi) | ||
; ANY-NEXT: movq %rax, 48(%rdi) | ||
; ANY-NEXT: movq %rax, 40(%rdi) | ||
; ANY-NEXT: movq %rax, 32(%rdi) | ||
; ANY-NEXT: movq %rax, 24(%rdi) | ||
; ANY-NEXT: movq %rax, 16(%rdi) | ||
; ANY-NEXT: movq %rax, 8(%rdi) | ||
; ANY-NEXT: movq %rax, (%rdi) | ||
; ANY-NEXT: retq | ||
; | ||
%call = tail call i8* @__memset_chk(i8* %x, i32 42, i64 64, i64 -1) | ||
ret void | ||
} | ||
|
||
define void @memset_128_nonzero_bytes(i8* %x) { | ||
; ANY-LABEL: memset_128_nonzero_bytes: | ||
; ANY: movabsq $3038287259199220266, %rax # imm = 0x2A2A2A2A2A2A2A2A | ||
; ANY-NEXT: movq %rax, 120(%rdi) | ||
; ANY-NEXT: movq %rax, 112(%rdi) | ||
; ANY-NEXT: movq %rax, 104(%rdi) | ||
; ANY-NEXT: movq %rax, 96(%rdi) | ||
; ANY-NEXT: movq %rax, 88(%rdi) | ||
; ANY-NEXT: movq %rax, 80(%rdi) | ||
; ANY-NEXT: movq %rax, 72(%rdi) | ||
; ANY-NEXT: movq %rax, 64(%rdi) | ||
; ANY-NEXT: movq %rax, 56(%rdi) | ||
; ANY-NEXT: movq %rax, 48(%rdi) | ||
; ANY-NEXT: movq %rax, 40(%rdi) | ||
; ANY-NEXT: movq %rax, 32(%rdi) | ||
; ANY-NEXT: movq %rax, 24(%rdi) | ||
; ANY-NEXT: movq %rax, 16(%rdi) | ||
; ANY-NEXT: movq %rax, 8(%rdi) | ||
; ANY-NEXT: movq %rax, (%rdi) | ||
; ANY-NEXT: retq | ||
; | ||
%call = tail call i8* @__memset_chk(i8* %x, i32 42, i64 128, i64 -1) | ||
ret void | ||
} | ||
|
||
define void @memset_256_nonzero_bytes(i8* %x) { | ||
; ANY-LABEL: memset_256_nonzero_bytes: | ||
; ANY: pushq %rax | ||
; ANY-NEXT: .Ltmp0: | ||
; ANY-NEXT: .cfi_def_cfa_offset 16 | ||
; ANY-NEXT: movl $42, %esi | ||
; ANY-NEXT: movl $256, %edx # imm = 0x100 | ||
; ANY-NEXT: callq memset | ||
; ANY-NEXT: popq %rax | ||
; ANY-NEXT: retq | ||
; | ||
%call = tail call i8* @__memset_chk(i8* %x, i32 42, i64 256, i64 -1) | ||
ret void | ||
} | ||
|
||
declare i8* @__memset_chk(i8*, i32, i64, i64) | ||
|