mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
7c9c6ed761
Essentially the same as the GEP change in r230786. A similar migration script can be used to update test cases, though a few more test case improvements/changes were required this time around: (r229269-r229278) import fileinput import sys import re pat = re.compile(r"((?:=|:|^)\s*load (?:atomic )?(?:volatile )?(.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$)") for line in sys.stdin: sys.stdout.write(re.sub(pat, r"\1, \2\3*\4", line)) Reviewers: rafael, dexonsmith, grosser Differential Revision: http://reviews.llvm.org/D7649 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230794 91177308-0d34-0410-b5e6-96231b3b80d8
58 lines
1.9 KiB
LLVM
58 lines
1.9 KiB
LLVM
; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s
|
|
|
|
; Verify that we're folding the load into the math instruction.
|
|
|
|
; FIXME: The folding should also happen without the avx attribute;
|
|
; ie, when generating SSE (non-VEX-prefixed) instructions.
|
|
|
|
define float @rcpss(float* %a) {
|
|
; CHECK-LABEL: rcpss:
|
|
; CHECK: vrcpss (%rdi), %xmm0, %xmm0
|
|
|
|
%ld = load float, float* %a
|
|
%ins = insertelement <4 x float> undef, float %ld, i32 0
|
|
%res = tail call <4 x float> @llvm.x86.sse.rcp.ss(<4 x float> %ins)
|
|
%ext = extractelement <4 x float> %res, i32 0
|
|
ret float %ext
|
|
}
|
|
|
|
define float @rsqrtss(float* %a) {
|
|
; CHECK-LABEL: rsqrtss:
|
|
; CHECK: vrsqrtss (%rdi), %xmm0, %xmm0
|
|
|
|
%ld = load float, float* %a
|
|
%ins = insertelement <4 x float> undef, float %ld, i32 0
|
|
%res = tail call <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float> %ins)
|
|
%ext = extractelement <4 x float> %res, i32 0
|
|
ret float %ext
|
|
}
|
|
|
|
define float @sqrtss(float* %a) {
|
|
; CHECK-LABEL: sqrtss:
|
|
; CHECK: vsqrtss (%rdi), %xmm0, %xmm0
|
|
|
|
%ld = load float, float* %a
|
|
%ins = insertelement <4 x float> undef, float %ld, i32 0
|
|
%res = tail call <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float> %ins)
|
|
%ext = extractelement <4 x float> %res, i32 0
|
|
ret float %ext
|
|
}
|
|
|
|
define double @sqrtsd(double* %a) {
|
|
; CHECK-LABEL: sqrtsd:
|
|
; CHECK: vsqrtsd (%rdi), %xmm0, %xmm0
|
|
|
|
%ld = load double, double* %a
|
|
%ins = insertelement <2 x double> undef, double %ld, i32 0
|
|
%res = tail call <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double> %ins)
|
|
%ext = extractelement <2 x double> %res, i32 0
|
|
ret double %ext
|
|
}
|
|
|
|
|
|
declare <4 x float> @llvm.x86.sse.rcp.ss(<4 x float>) nounwind readnone
|
|
declare <4 x float> @llvm.x86.sse.rsqrt.ss(<4 x float>) nounwind readnone
|
|
declare <4 x float> @llvm.x86.sse.sqrt.ss(<4 x float>) nounwind readnone
|
|
declare <2 x double> @llvm.x86.sse2.sqrt.sd(<2 x double>) nounwind readnone
|
|
|