llvm/llvm/test/Feature/vector-cast-constant-exprs.ll

; 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>)
}