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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [masklr_1.F90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! Test the MASKL and MASKR intrinsics.
2
!
3
! { dg-do run }
4
! { dg-options "-ffree-line-length-none" }
5
 
6
#define CHECK(I,KIND,FUNCL,FUNCR,RESL,RESR) \
7
  if (maskl(I,KIND) /= RESL) call abort ; \
8
  if (FUNCL(I) /= RESL) call abort ; \
9
  if (maskr(I,KIND) /= RESR) call abort ; \
10
  if (FUNCR(I) /= RESR) call abort
11
 
12
  CHECK(0,1,run_maskl1,run_maskr1,0_1,0_1)
13
  CHECK(1,1,run_maskl1,run_maskr1,-huge(0_1)-1_1,1_1)
14
  CHECK(2,1,run_maskl1,run_maskr1,(-huge(0_1)-1_1)/2_1,3_1)
15
  CHECK(3,1,run_maskl1,run_maskr1,(-huge(0_1)-1_1)/4_1,7_1)
16
  CHECK(int(bit_size(0_1))-2,1,run_maskl1,run_maskr1,-4_1,huge(0_1)/2_1)
17
  CHECK(int(bit_size(0_1))-1,1,run_maskl1,run_maskr1,-2_1,huge(0_1))
18
  CHECK(int(bit_size(0_1)),1,run_maskl1,run_maskr1,-1_1,-1_1)
19
 
20
  CHECK(0,2,run_maskl2,run_maskr2,0_2,0_2)
21
  CHECK(1,2,run_maskl2,run_maskr2,-huge(0_2)-1_2,1_2)
22
  CHECK(2,2,run_maskl2,run_maskr2,(-huge(0_2)-1_2)/2_2,3_2)
23
  CHECK(3,2,run_maskl2,run_maskr2,(-huge(0_2)-1_2)/4_2,7_2)
24
  CHECK(int(bit_size(0_2))-2,2,run_maskl2,run_maskr2,-4_2,huge(0_2)/2_2)
25
  CHECK(int(bit_size(0_2))-1,2,run_maskl2,run_maskr2,-2_2,huge(0_2))
26
  CHECK(int(bit_size(0_2)),2,run_maskl2,run_maskr2,-1_2,-1_2)
27
 
28
  CHECK(0,4,run_maskl4,run_maskr4,0_4,0_4)
29
  CHECK(1,4,run_maskl4,run_maskr4,-huge(0_4)-1_4,1_4)
30
  CHECK(2,4,run_maskl4,run_maskr4,(-huge(0_4)-1_4)/2_4,3_4)
31
  CHECK(3,4,run_maskl4,run_maskr4,(-huge(0_4)-1_4)/4_4,7_4)
32
  CHECK(int(bit_size(0_4))-2,4,run_maskl4,run_maskr4,-4_4,huge(0_4)/2_4)
33
  CHECK(int(bit_size(0_4))-1,4,run_maskl4,run_maskr4,-2_4,huge(0_4))
34
  CHECK(int(bit_size(0_4)),4,run_maskl4,run_maskr4,-1_4,-1_4)
35
 
36
  CHECK(0,8,run_maskl8,run_maskr8,0_8,0_8)
37
  CHECK(1,8,run_maskl8,run_maskr8,-huge(0_8)-1_8,1_8)
38
  CHECK(2,8,run_maskl8,run_maskr8,(-huge(0_8)-1_8)/2_8,3_8)
39
  CHECK(3,8,run_maskl8,run_maskr8,(-huge(0_8)-1_8)/4_8,7_8)
40
  CHECK(int(bit_size(0_8))-2,8,run_maskl8,run_maskr8,-4_8,huge(0_8)/2_8)
41
  CHECK(int(bit_size(0_8))-1,8,run_maskl8,run_maskr8,-2_8,huge(0_8))
42
  CHECK(int(bit_size(0_8)),8,run_maskl8,run_maskr8,-1_8,-1_8)
43
 
44
contains
45
 
46
  pure integer(kind=1) function run_maskl1(i) result(res)
47
    integer, intent(in) :: i
48
    res = maskl(i,kind=1)
49
  end function
50
  pure integer(kind=1) function run_maskr1(i) result(res)
51
    integer, intent(in) :: i
52
    res = maskr(i,kind=1)
53
  end function
54
 
55
  pure integer(kind=2) function run_maskl2(i) result(res)
56
    integer, intent(in) :: i
57
    res = maskl(i,kind=2)
58
  end function
59
  pure integer(kind=2) function run_maskr2(i) result(res)
60
    integer, intent(in) :: i
61
    res = maskr(i,kind=2)
62
  end function
63
 
64
  pure integer(kind=4) function run_maskl4(i) result(res)
65
    integer, intent(in) :: i
66
    res = maskl(i,kind=4)
67
  end function
68
  pure integer(kind=4) function run_maskr4(i) result(res)
69
    integer, intent(in) :: i
70
    res = maskr(i,kind=4)
71
  end function
72
 
73
  pure integer(kind=8) function run_maskl8(i) result(res)
74
    integer, intent(in) :: i
75
    res = maskl(i,kind=8)
76
  end function
77
  pure integer(kind=8) function run_maskr8(i) result(res)
78
    integer, intent(in) :: i
79
    res = maskr(i,kind=8)
80
  end function
81
 
82
end

powered by: WebSVN 2.1.0

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