Skip to content

Instantly share code, notes, and snippets.

@anarazel
Created September 10, 2018 20:04
Show Gist options
  • Save anarazel/d3da35d2ae9d7760d5677267da06b77c to your computer and use it in GitHub Desktop.
Save anarazel/d3da35d2ae9d7760d5677267da06b77c to your computer and use it in GitHub Desktop.
$ cat /tmp/combine.ll
; ModuleID = '<stdin>'
source_filename = "pg"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
define void @evalexpr_0_0(i8* align 8 noalias, i32* align 8 noalias) {
entry:
%a01 = getelementptr i8, i8* %0, i16 0
store i8 0, i8* %a01
; in the real case this also loads data
%b01 = getelementptr i32, i32* %1, i16 0
store i32 0, i32* %b01
%a02 = getelementptr i8, i8* %0, i16 1
store i8 0, i8* %a02
; in the real case this also loads data
%b02 = getelementptr i32, i32* %1, i16 1
store i32 0, i32* %b02
; in the real case this also loads data
%a03 = getelementptr i8, i8* %0, i16 2
store i8 0, i8* %a03
; in the real case this also loads data
%b03 = getelementptr i32, i32* %1, i16 2
store i32 0, i32* %b03
%a04 = getelementptr i8, i8* %0, i16 3
store i8 0, i8* %a04
; in the real case this also loads data
%b04 = getelementptr i32, i32* %1, i16 3
store i32 0, i32* %b04
ret void
}
$ opt -disable-slp-vectorization -O3 -S /tmp/combine.ll |llc -O3|less
.text
.file "pg"
.globl evalexpr_0_0 # -- Begin function evalexpr_0_0
.p2align 4, 0x90
.type evalexpr_0_0,@function
evalexpr_0_0: # @evalexpr_0_0
# %bb.0: # %entry
movb $0, (%rdi)
movl $0, (%rsi)
movb $0, 1(%rdi)
movl $0, 4(%rsi)
movb $0, 2(%rdi)
movl $0, 8(%rsi)
movb $0, 3(%rdi)
movl $0, 12(%rsi)
retq
.Lfunc_end0:
.size evalexpr_0_0, .Lfunc_end0-evalexpr_0_0
# -- End function
.section ".note.GNU-stack","",@progbits
$ opt -O3 -S /tmp/combine.ll |llc -O3|less
.text
.file "pg"
.globl evalexpr_0_0 # -- Begin function evalexpr_0_0
.p2align 4, 0x90
.type evalexpr_0_0,@function
evalexpr_0_0: # @evalexpr_0_0
# %bb.0: # %entry
movl $0, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
retq
.Lfunc_end0:
.size evalexpr_0_0, .Lfunc_end0-evalexpr_0_0
# -- End function
.section ".note.GNU-stack","",@progbits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment