1 ! Testcases for the AND, OR and XOR functions (GNU intrinsics).
3 ! { dg-options "-ffixed-line-length-none" }
11 logical(kind=8) l8, k8
13 #define TEST_INTEGER(u,ukind,v,vkind) \
16 if (iand(u,v) /= and(ukind, vkind)) call abort;\
17 if (iand(u,v) /= and(vkind, ukind)) call abort;\
18 if (ieor(u,v) /= xor(ukind, vkind)) call abort;\
19 if (ieor(u,v) /= xor(vkind, ukind)) call abort;\
20 if (ior(u,v) /= or(ukind, vkind)) call abort;\
21 if (ior(u,v) /= or(vkind, ukind)) call abort
23 TEST_INTEGER(19,i1,6,j1)
24 TEST_INTEGER(19,i1,6,j2)
25 TEST_INTEGER(19,i1,6,j4)
26 TEST_INTEGER(19,i1,6,j8)
28 TEST_INTEGER(19,i2,6,j1)
29 TEST_INTEGER(19,i2,6,j2)
30 TEST_INTEGER(19,i2,6,j4)
31 TEST_INTEGER(19,i2,6,j8)
33 TEST_INTEGER(19,i4,6,j1)
34 TEST_INTEGER(19,i4,6,j2)
35 TEST_INTEGER(19,i4,6,j4)
36 TEST_INTEGER(19,i4,6,j8)
38 TEST_INTEGER(19,i8,6,j1)
39 TEST_INTEGER(19,i8,6,j2)
40 TEST_INTEGER(19,i8,6,j4)
41 TEST_INTEGER(19,i8,6,j8)
45 #define TEST_LOGICAL(u,ukind,v,vkind) \
48 if ((u .and. v) .neqv. and(ukind, vkind)) call abort;\
49 if ((u .and. v) .neqv. and(vkind, ukind)) call abort;\
50 if (((u .and. .not. v) .or. (.not. u .and. v)) .neqv. xor(ukind, vkind)) call abort;\
51 if (((u .and. .not. v) .or. (.not. u .and. v)) .neqv. xor(vkind, ukind)) call abort;\
52 if ((u .or. v) .neqv. or(ukind, vkind)) call abort;\
53 if ((u .or. v) .neqv. or(vkind, ukind)) call abort
55 TEST_LOGICAL(.true.,l1,.false.,k1)
56 TEST_LOGICAL(.true.,l1,.true.,k1)
57 TEST_LOGICAL(.true.,l1,.false.,k2)
58 TEST_LOGICAL(.true.,l1,.true.,k2)
59 TEST_LOGICAL(.true.,l1,.false.,k4)
60 TEST_LOGICAL(.true.,l1,.true.,k4)
61 TEST_LOGICAL(.true.,l1,.false.,k8)
62 TEST_LOGICAL(.true.,l1,.true.,k8)
64 TEST_LOGICAL(.true.,l2,.false.,k1)
65 TEST_LOGICAL(.true.,l2,.true.,k1)
66 TEST_LOGICAL(.true.,l2,.false.,k2)
67 TEST_LOGICAL(.true.,l2,.true.,k2)
68 TEST_LOGICAL(.true.,l2,.false.,k4)
69 TEST_LOGICAL(.true.,l2,.true.,k4)
70 TEST_LOGICAL(.true.,l2,.false.,k8)
71 TEST_LOGICAL(.true.,l2,.true.,k8)
73 TEST_LOGICAL(.true.,l4,.false.,k1)
74 TEST_LOGICAL(.true.,l4,.true.,k1)
75 TEST_LOGICAL(.true.,l4,.false.,k2)
76 TEST_LOGICAL(.true.,l4,.true.,k2)
77 TEST_LOGICAL(.true.,l4,.false.,k4)
78 TEST_LOGICAL(.true.,l4,.true.,k4)
79 TEST_LOGICAL(.true.,l4,.false.,k8)
80 TEST_LOGICAL(.true.,l4,.true.,k8)
82 TEST_LOGICAL(.true.,l8,.false.,k1)
83 TEST_LOGICAL(.true.,l8,.true.,k1)
84 TEST_LOGICAL(.true.,l8,.false.,k2)
85 TEST_LOGICAL(.true.,l8,.true.,k2)
86 TEST_LOGICAL(.true.,l8,.false.,k4)
87 TEST_LOGICAL(.true.,l8,.true.,k4)
88 TEST_LOGICAL(.true.,l8,.false.,k8)
89 TEST_LOGICAL(.true.,l8,.true.,k8)