aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Feature/vector-cast-constant-exprs.ll
blob: 3a9d5525c43aaaa366485a43cbf26e0989a9c0e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt -S -passes=instsimplify < %s | FileCheck %s

; All of these constant expressions should fold.

define <2 x float> @ga() {
; CHECK-LABEL: define <2 x float> @ga() {
; CHECK-NEXT:    ret <2 x float> <float 0x4011333340000000, float 0x40099999A0000000>
;
  %fptrunc = fptrunc <2 x double> <double 4.3, double 3.2> to <2 x float>
  ret <2 x float> %fptrunc
}
define <2 x double> @gb() {
; CHECK-LABEL: define <2 x double> @gb() {
; CHECK-NEXT:    ret <2 x double> <double 2.000000e+00, double 8.000000e+00>
;
  %fpext = fpext <2 x float><float 2.0, float 8.0> to <2 x double>
  ret <2 x double> %fpext
}
define <2 x i32> @gf() {
; CHECK-LABEL: define <2 x i32> @gf() {
; CHECK-NEXT:    ret <2 x i32> <i32 3, i32 4>
;
  ret <2 x i32> trunc (<2 x i64><i64 3, i64 4> to <2 x i32>)
}
define <2 x i32> @gh() {
; CHECK-LABEL: define <2 x i32> @gh() {
; CHECK-NEXT:    ret <2 x i32> <i32 8, i32 7>
;
  %fptoui = fptoui <2 x float><float 8.0, float 7.0> to <2 x i32>
  ret <2 x i32> %fptoui
}
define <2 x i32> @gi() {
; CHECK-LABEL: define <2 x i32> @gi() {
; CHECK-NEXT:    ret <2 x i32> <i32 8, i32 7>
;
  %fptosi = fptosi <2 x float><float 8.0, float 7.0> to <2 x i32>
  ret <2 x i32> %fptosi
}
define <2 x float> @gj() {
; CHECK-LABEL: define <2 x float> @gj() {
; CHECK-NEXT:    ret <2 x float> <float 8.000000e+00, float 7.000000e+00>
;
  %uitofp = uitofp <2 x i32><i32 8, i32 7> to <2 x float>
  ret <2 x float> %uitofp
}
define <2 x float> @gk() {
; CHECK-LABEL: define <2 x float> @gk() {
; CHECK-NEXT:    ret <2 x float> <float 8.000000e+00, float 7.000000e+00>
;
  %sitofp = sitofp <2 x i32><i32 8, i32 7> to <2 x float>
  ret <2 x float> %sitofp
}
define <2 x double> @gl() {
; CHECK-LABEL: define <2 x double> @gl() {
; CHECK-NEXT:    ret <2 x double> <double 4.000000e+00, double 3.000000e+00>
;
  ret <2 x double> bitcast (<2 x double><double 4.0, double 3.0> to <2 x double>)
}
define <2 x double> @gm() {
; CHECK-LABEL: define <2 x double> @gm() {
; CHECK-NEXT:    ret <2 x double> <double 1.976260e-323, double 1.482200e-323>
;
  ret <2 x double> bitcast (<2 x i64><i64 4, i64 3> to <2 x double>)
}