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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [intrinsic_cshift.f90] - Blame information for rev 695

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 695 jeremybenn
! Program to test the cshift intrinsic
2
program intrinsic_cshift
3
   integer, dimension(3, 3) :: a
4
   integer, dimension(3, 3, 2) :: b
5
 
6
   ! Scalar shift
7
   a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
8
   a = cshift (a, 1, 1)
9
   if (any (a .ne. reshape ((/2, 3, 1, 5, 6, 4, 8, 9, 7/), (/3, 3/)))) &
10
      call abort
11
 
12
   a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
13
   a = cshift (a, -2, dim = 2)
14
   if (any (a .ne. reshape ((/4, 5, 6, 7, 8, 9, 1, 2, 3/), (/3, 3/)))) &
15
      call abort
16
 
17
   ! Array shift
18
   a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
19
   a = cshift (a, (/1, 0, -1/))
20
   if (any (a .ne. reshape ((/2, 3, 1, 4, 5, 6, 9, 7, 8/), (/3, 3/)))) &
21
      call abort
22
 
23
   a = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/))
24
   a = cshift (a, (/2, -2, 0/), dim = 2)
25
   if (any (a .ne. reshape ((/7, 5, 3, 1, 8, 6, 4, 2, 9/), (/3, 3/)))) &
26
      call abort
27
 
28
   ! Test arrays > rank 2
29
   b = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17,&
30
         18, 19/), (/3, 3, 2/))
31
   b = cshift (b, 1)
32
   if (any (b .ne. reshape ((/2, 3, 1, 5, 6, 4, 8, 9, 7, 12, 13, 11, 15,&
33
     16, 14, 18, 19, 17/), (/3, 3, 2/)))) &
34
      call abort
35
 
36
   b = reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17,&
37
         18, 19/), (/3, 3, 2/))
38
   b = cshift (b, reshape ((/1, 2, 3, 4, 5, 6, 7, 8, 9/), (/3, 3/)), 3)
39
   if (any (b .ne. reshape ((/11, 2, 13, 4, 15, 6, 17, 8, 19, 1, 12, 3,&
40
     14, 5, 16, 7, 18, 9/), (/3, 3, 2/)))) &
41
      call abort
42
 
43
end program

powered by: WebSVN 2.1.0

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