Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 1 | // REQUIRES: ppc64-registered-target |
| 2 | // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 3 | |
| 4 | float crealf(_Complex float); |
| 5 | double creal(_Complex double); |
| 6 | long double creall(_Complex long double); |
| 7 | |
| 8 | _Complex float foo_float(_Complex float x) { |
| 9 | return x; |
| 10 | } |
| 11 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 12 | // CHECK: define { float, float } @foo_float(float {{[%A-Za-z0-9.]+}}, float {{[%A-Za-z0-9.]+}}) [[NUW:#[0-9]+]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 13 | |
| 14 | _Complex double foo_double(_Complex double x) { |
| 15 | return x; |
| 16 | } |
| 17 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 18 | // CHECK: define { double, double } @foo_double(double {{[%A-Za-z0-9.]+}}, double {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 19 | |
| 20 | _Complex long double foo_long_double(_Complex long double x) { |
| 21 | return x; |
| 22 | } |
| 23 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 24 | // CHECK: define { ppc_fp128, ppc_fp128 } @foo_long_double(ppc_fp128 {{[%A-Za-z0-9.]+}}, ppc_fp128 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 25 | |
| 26 | _Complex int foo_int(_Complex int x) { |
| 27 | return x; |
| 28 | } |
| 29 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 30 | // CHECK: define { i32, i32 } @foo_int(i32 {{[%A-Za-z0-9.]+}}, i32 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 31 | |
| 32 | _Complex short foo_short(_Complex short x) { |
| 33 | return x; |
| 34 | } |
| 35 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 36 | // CHECK: define { i16, i16 } @foo_short(i16 {{[%A-Za-z0-9.]+}}, i16 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 37 | |
| 38 | _Complex signed char foo_char(_Complex signed char x) { |
| 39 | return x; |
| 40 | } |
| 41 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 42 | // CHECK: define { i8, i8 } @foo_char(i8 {{[%A-Za-z0-9.]+}}, i8 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 43 | |
| 44 | _Complex long foo_long(_Complex long x) { |
| 45 | return x; |
| 46 | } |
| 47 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 48 | // CHECK: define { i64, i64 } @foo_long(i64 {{[%A-Za-z0-9.]+}}, i64 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 49 | |
| 50 | _Complex long long foo_long_long(_Complex long long x) { |
| 51 | return x; |
| 52 | } |
| 53 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 54 | // CHECK: define { i64, i64 } @foo_long_long(i64 {{[%A-Za-z0-9.]+}}, i64 {{[%A-Za-z0-9.]+}}) [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 55 | |
| 56 | float bar_float(void) { |
| 57 | return crealf(foo_float(2.0f - 2.5fi)); |
| 58 | } |
| 59 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 60 | // CHECK: define float @bar_float() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 61 | // CHECK: [[VAR1:[%A-Za-z0-9.]+]] = call { float, float } @foo_float |
| 62 | // CHECK: extractvalue { float, float } [[VAR1]], 0 |
| 63 | // CHECK: extractvalue { float, float } [[VAR1]], 1 |
| 64 | |
| 65 | double bar_double(void) { |
| 66 | return creal(foo_double(2.0 - 2.5i)); |
| 67 | } |
| 68 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 69 | // CHECK: define double @bar_double() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 70 | // CHECK: [[VAR2:[%A-Za-z0-9.]+]] = call { double, double } @foo_double |
| 71 | // CHECK: extractvalue { double, double } [[VAR2]], 0 |
| 72 | // CHECK: extractvalue { double, double } [[VAR2]], 1 |
| 73 | |
| 74 | long double bar_long_double(void) { |
| 75 | return creall(foo_long_double(2.0L - 2.5Li)); |
| 76 | } |
| 77 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 78 | // CHECK: define ppc_fp128 @bar_long_double() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 79 | // CHECK: [[VAR3:[%A-Za-z0-9.]+]] = call { ppc_fp128, ppc_fp128 } @foo_long_double |
| 80 | // CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 0 |
| 81 | // CHECK: extractvalue { ppc_fp128, ppc_fp128 } [[VAR3]], 1 |
| 82 | |
| 83 | int bar_int(void) { |
| 84 | return __real__(foo_int(2 - 3i)); |
| 85 | } |
| 86 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 87 | // CHECK: define signext i32 @bar_int() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 88 | // CHECK: [[VAR4:[%A-Za-z0-9.]+]] = call { i32, i32 } @foo_int |
| 89 | // CHECK: extractvalue { i32, i32 } [[VAR4]], 0 |
| 90 | // CHECK: extractvalue { i32, i32 } [[VAR4]], 1 |
| 91 | |
| 92 | short bar_short(void) { |
| 93 | return __real__(foo_short(2 - 3i)); |
| 94 | } |
| 95 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 96 | // CHECK: define signext i16 @bar_short() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 97 | // CHECK: [[VAR5:[%A-Za-z0-9.]+]] = call { i16, i16 } @foo_short |
| 98 | // CHECK: extractvalue { i16, i16 } [[VAR5]], 0 |
| 99 | // CHECK: extractvalue { i16, i16 } [[VAR5]], 1 |
| 100 | |
| 101 | signed char bar_char(void) { |
| 102 | return __real__(foo_char(2 - 3i)); |
| 103 | } |
| 104 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 105 | // CHECK: define signext i8 @bar_char() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 106 | // CHECK: [[VAR6:[%A-Za-z0-9.]+]] = call { i8, i8 } @foo_char |
| 107 | // CHECK: extractvalue { i8, i8 } [[VAR6]], 0 |
| 108 | // CHECK: extractvalue { i8, i8 } [[VAR6]], 1 |
| 109 | |
| 110 | long bar_long(void) { |
| 111 | return __real__(foo_long(2L - 3Li)); |
| 112 | } |
| 113 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 114 | // CHECK: define i64 @bar_long() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 115 | // CHECK: [[VAR7:[%A-Za-z0-9.]+]] = call { i64, i64 } @foo_long |
| 116 | // CHECK: extractvalue { i64, i64 } [[VAR7]], 0 |
| 117 | // CHECK: extractvalue { i64, i64 } [[VAR7]], 1 |
| 118 | |
| 119 | long long bar_long_long(void) { |
| 120 | return __real__(foo_long_long(2LL - 3LLi)); |
| 121 | } |
| 122 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 123 | // CHECK: define i64 @bar_long_long() [[NUW]] { |
Bill Schmidt | 9e6111a | 2012-12-17 04:20:17 +0000 | [diff] [blame] | 124 | // CHECK: [[VAR8:[%A-Za-z0-9.]+]] = call { i64, i64 } @foo_long_long |
| 125 | // CHECK: extractvalue { i64, i64 } [[VAR8]], 0 |
| 126 | // CHECK: extractvalue { i64, i64 } [[VAR8]], 1 |
| 127 | |
Bill Wendling | f7a9da0 | 2013-02-20 07:22:19 +0000 | [diff] [blame] | 128 | |
Bill Wendling | c3af679 | 2013-02-26 23:08:48 +0000 | [diff] [blame^] | 129 | // CHECK: attributes [[NUW]] = { nounwind{{.*}} } |