OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [intrinsic_pack_2.f90] - Rev 801

Go to most recent revision | Compare with Previous | Blame | View Log

! { dg-do run }
! { dg-require-effective-target fortran_large_real }
! Take the pack intrinsic through its paces, with all types that are
! normally accessible.
program main
  implicit none
  integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
  integer :: i
  real(kind=k), dimension(3,3) :: rk
  real(kind=k), dimension(9) :: vrk
  real(kind=k), dimension(9) :: rrk
  complex(kind=k), dimension(3,3) :: ck
  complex(kind=k), dimension(9) :: vck
  complex(kind=k), dimension(9) :: rck

  vrk = (/(i+10,i=1,9)/)
  rk = reshape((/1.0_k, -3.0_k, 2.1_k, -4.21_k, 1.2_k, 0.98_k, -1.2_k, &
  &              -7.1_k, -9.9_k, 0.3_k /), shape(rk))
  rrk = pack(rk,rk>0,vrk)
  if (any(rrk /= (/ 1.0_k, 2.1_k, 1.2_k, 0.98_k,  15._k, 16._k, 17._k, &
  &                  18._k, 19._k /))) call abort

  vck = (/(i+10,i=1,9)/)
  ck = reshape((/1.0_k, -3.0_k, 2.1_k, -4.21_k, 1.2_k, 0.98_k, -1.2_k, &
  &              -7.1_k, -9.9_k, 0.3_k /), shape(ck))
  rck = pack(ck,real(ck)>0,vck)
  if (any(real(rck) /= (/ 1.0_k, 2.1_k, 1.2_k, 0.98_k,  15._k, 16._k, 17._k, &
  &                  18._k, 19._k /))) call abort
  if (any(aimag(rck) /= 0)) call abort

end program main

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.