2015-11-24 05:33:58 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
2019-06-11 12:30:53 +08:00
|
|
|
; RUN: llc -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+sse2 < %s | FileCheck %s --check-prefix=SSE
|
|
|
|
; RUN: llc -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefix=AVX --check-prefix=AVX1
|
|
|
|
; RUN: llc -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512f < %s | FileCheck %s --check-prefix=AVX --check-prefix=AVX512
|
2015-06-23 04:51:51 +08:00
|
|
|
|
|
|
|
; Verify that we're folding the load into the math instruction.
|
|
|
|
; This pattern is generated out of the simplest intrinsics usage:
|
|
|
|
; _mm_add_ss(a, _mm_load_ss(b));
|
|
|
|
|
|
|
|
define <4 x float> @addss(<4 x float> %va, float* %pb) {
|
|
|
|
; SSE-LABEL: addss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: addss (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: addss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vaddss (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <4 x float> %va, i32 0
|
|
|
|
%b = load float, float* %pb
|
|
|
|
%r = fadd float %a, %b
|
|
|
|
%vr = insertelement <4 x float> %va, float %r, i32 0
|
|
|
|
ret <4 x float> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x double> @addsd(<2 x double> %va, double* %pb) {
|
|
|
|
; SSE-LABEL: addsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: addsd (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: addsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vaddsd (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <2 x double> %va, i32 0
|
|
|
|
%b = load double, double* %pb
|
|
|
|
%r = fadd double %a, %b
|
|
|
|
%vr = insertelement <2 x double> %va, double %r, i32 0
|
|
|
|
ret <2 x double> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @subss(<4 x float> %va, float* %pb) {
|
|
|
|
; SSE-LABEL: subss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: subss (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: subss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vsubss (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <4 x float> %va, i32 0
|
|
|
|
%b = load float, float* %pb
|
|
|
|
%r = fsub float %a, %b
|
|
|
|
%vr = insertelement <4 x float> %va, float %r, i32 0
|
|
|
|
ret <4 x float> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x double> @subsd(<2 x double> %va, double* %pb) {
|
|
|
|
; SSE-LABEL: subsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: subsd (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: subsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vsubsd (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <2 x double> %va, i32 0
|
|
|
|
%b = load double, double* %pb
|
|
|
|
%r = fsub double %a, %b
|
|
|
|
%vr = insertelement <2 x double> %va, double %r, i32 0
|
|
|
|
ret <2 x double> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @mulss(<4 x float> %va, float* %pb) {
|
|
|
|
; SSE-LABEL: mulss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: mulss (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: mulss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vmulss (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <4 x float> %va, i32 0
|
|
|
|
%b = load float, float* %pb
|
|
|
|
%r = fmul float %a, %b
|
|
|
|
%vr = insertelement <4 x float> %va, float %r, i32 0
|
|
|
|
ret <4 x float> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x double> @mulsd(<2 x double> %va, double* %pb) {
|
|
|
|
; SSE-LABEL: mulsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: mulsd (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: mulsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vmulsd (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <2 x double> %va, i32 0
|
|
|
|
%b = load double, double* %pb
|
|
|
|
%r = fmul double %a, %b
|
|
|
|
%vr = insertelement <2 x double> %va, double %r, i32 0
|
|
|
|
ret <2 x double> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <4 x float> @divss(<4 x float> %va, float* %pb) {
|
|
|
|
; SSE-LABEL: divss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: divss (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: divss:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vdivss (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <4 x float> %va, i32 0
|
|
|
|
%b = load float, float* %pb
|
|
|
|
%r = fdiv float %a, %b
|
|
|
|
%vr = insertelement <4 x float> %va, float %r, i32 0
|
|
|
|
ret <4 x float> %vr
|
|
|
|
}
|
|
|
|
|
|
|
|
define <2 x double> @divsd(<2 x double> %va, double* %pb) {
|
|
|
|
; SSE-LABEL: divsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; SSE: # %bb.0:
|
2015-06-23 04:51:51 +08:00
|
|
|
; SSE-NEXT: divsd (%rdi), %xmm0
|
|
|
|
; SSE-NEXT: retq
|
|
|
|
;
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-LABEL: divsd:
|
2017-12-05 01:18:51 +08:00
|
|
|
; AVX: # %bb.0:
|
2016-07-29 14:06:04 +08:00
|
|
|
; AVX-NEXT: vdivsd (%rdi), %xmm0, %xmm0
|
|
|
|
; AVX-NEXT: retq
|
2015-06-23 04:51:51 +08:00
|
|
|
%a = extractelement <2 x double> %va, i32 0
|
|
|
|
%b = load double, double* %pb
|
|
|
|
%r = fdiv double %a, %b
|
|
|
|
%vr = insertelement <2 x double> %va, double %r, i32 0
|
|
|
|
ret <2 x double> %vr
|
|
|
|
}
|