@@ -982,7 +982,7 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
982
982
let llcast = PointerCast ( bcx, llcast, T_ptr ( T_i8 ( ) ) ) ;
983
983
call_memcpy ( bcx, llretptr, llcast, llsize_of ( ccx, lltp_ty) ) ;
984
984
}
985
- }
985
+ }
986
986
~"addr_of" => {
987
987
Store ( bcx, get_param ( decl, first_real_arg) , fcx. llretptr ) ;
988
988
}
@@ -1033,6 +1033,164 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::foreign_item,
1033
1033
T_ptr ( T_nil ( ) ) ) ;
1034
1034
Store ( bcx, morestack_addr, fcx. llretptr ) ;
1035
1035
}
1036
+ ~"sqrtf32" => {
1037
+ let x = get_param ( decl, first_real_arg) ;
1038
+ let sqrtf = ccx. intrinsics . get ( ~"llvm. sqrt . f32 ") ;
1039
+ Store ( bcx, Call ( bcx, sqrtf, ~[ x] ) , fcx. llretptr ) ;
1040
+ }
1041
+ ~"sqrtf64" => {
1042
+ let x = get_param ( decl, first_real_arg) ;
1043
+ let sqrtf = ccx. intrinsics . get ( ~"llvm. sqrt . f64 ") ;
1044
+ Store ( bcx, Call ( bcx, sqrtf, ~[ x] ) , fcx. llretptr ) ;
1045
+ }
1046
+ ~"powif32" => {
1047
+ let a = get_param ( decl, first_real_arg) ;
1048
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1049
+ let powif = ccx. intrinsics . get ( ~"llvm. powi . f32 ") ;
1050
+ Store ( bcx, Call ( bcx, powif, ~[ a, x] ) , fcx. llretptr ) ;
1051
+ }
1052
+ ~"powif64" => {
1053
+ let a = get_param ( decl, first_real_arg) ;
1054
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1055
+ let powif = ccx. intrinsics . get ( ~"llvm. powi . f64 ") ;
1056
+ Store ( bcx, Call ( bcx, powif, ~[ a, x] ) , fcx. llretptr ) ;
1057
+ }
1058
+ ~"sinf32" => {
1059
+ let x = get_param ( decl, first_real_arg) ;
1060
+ let sinf = ccx. intrinsics . get ( ~"llvm. sin . f32 ") ;
1061
+ Store ( bcx, Call ( bcx, sinf, ~[ x] ) , fcx. llretptr ) ;
1062
+ }
1063
+ ~"sinf64" => {
1064
+ let x = get_param ( decl, first_real_arg) ;
1065
+ let sinf = ccx. intrinsics . get ( ~"llvm. sin . f64 ") ;
1066
+ Store ( bcx, Call ( bcx, sinf, ~[ x] ) , fcx. llretptr ) ;
1067
+ }
1068
+ ~"cosf32" => {
1069
+ let x = get_param ( decl, first_real_arg) ;
1070
+ let cosf = ccx. intrinsics . get ( ~"llvm. cos . f32 ") ;
1071
+ Store ( bcx, Call ( bcx, cosf, ~[ x] ) , fcx. llretptr ) ;
1072
+ }
1073
+ ~"cosf64" => {
1074
+ let x = get_param ( decl, first_real_arg) ;
1075
+ let cosf = ccx. intrinsics . get ( ~"llvm. cos . f64 ") ;
1076
+ Store ( bcx, Call ( bcx, cosf, ~[ x] ) , fcx. llretptr ) ;
1077
+ }
1078
+ ~"powf32" => {
1079
+ let a = get_param ( decl, first_real_arg) ;
1080
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1081
+ let powf = ccx. intrinsics . get ( ~"llvm. pow . f32 ") ;
1082
+ Store ( bcx, Call ( bcx, powf, ~[ a, x] ) , fcx. llretptr ) ;
1083
+ }
1084
+ ~"powf64" => {
1085
+ let a = get_param ( decl, first_real_arg) ;
1086
+ let x = get_param ( decl, first_real_arg + 1 u) ;
1087
+ let powf = ccx. intrinsics . get ( ~"llvm. pow . f64 ") ;
1088
+ Store ( bcx, Call ( bcx, powf, ~[ a, x] ) , fcx. llretptr ) ;
1089
+ }
1090
+ ~"expf32" => {
1091
+ let x = get_param ( decl, first_real_arg) ;
1092
+ let expf = ccx. intrinsics . get ( ~"llvm. exp . f32 ") ;
1093
+ Store ( bcx, Call ( bcx, expf, ~[ x] ) , fcx. llretptr ) ;
1094
+ }
1095
+ ~"expf64" => {
1096
+ let x = get_param ( decl, first_real_arg) ;
1097
+ let expf = ccx. intrinsics . get ( ~"llvm. exp . f64 ") ;
1098
+ Store ( bcx, Call ( bcx, expf, ~[ x] ) , fcx. llretptr ) ;
1099
+ }
1100
+ ~"exp2f32" => {
1101
+ let x = get_param ( decl, first_real_arg) ;
1102
+ let exp2f = ccx. intrinsics . get ( ~"llvm. exp2 . f32 ") ;
1103
+ Store ( bcx, Call ( bcx, exp2f, ~[ x] ) , fcx. llretptr ) ;
1104
+ }
1105
+ ~"exp2f64" => {
1106
+ let x = get_param ( decl, first_real_arg) ;
1107
+ let exp2f = ccx. intrinsics . get ( ~"llvm. exp2 . f64 ") ;
1108
+ Store ( bcx, Call ( bcx, exp2f, ~[ x] ) , fcx. llretptr ) ;
1109
+ }
1110
+ ~"logf32" => {
1111
+ let x = get_param ( decl, first_real_arg) ;
1112
+ let logf = ccx. intrinsics . get ( ~"llvm. log . f32 ") ;
1113
+ Store ( bcx, Call ( bcx, logf, ~[ x] ) , fcx. llretptr ) ;
1114
+ }
1115
+ ~"logf64" => {
1116
+ let x = get_param ( decl, first_real_arg) ;
1117
+ let logf = ccx. intrinsics . get ( ~"llvm. log . f64 ") ;
1118
+ Store ( bcx, Call ( bcx, logf, ~[ x] ) , fcx. llretptr ) ;
1119
+ }
1120
+ ~"log10f32" => {
1121
+ let x = get_param ( decl, first_real_arg) ;
1122
+ let log10f = ccx. intrinsics . get ( ~"llvm. log10 . f32 ") ;
1123
+ Store ( bcx, Call ( bcx, log10f, ~[ x] ) , fcx. llretptr ) ;
1124
+ }
1125
+ ~"log10f64" => {
1126
+ let x = get_param ( decl, first_real_arg) ;
1127
+ let log10f = ccx. intrinsics . get ( ~"llvm. log10 . f64 ") ;
1128
+ Store ( bcx, Call ( bcx, log10f, ~[ x] ) , fcx. llretptr ) ;
1129
+ }
1130
+ ~"log2f32" => {
1131
+ let x = get_param ( decl, first_real_arg) ;
1132
+ let log2f = ccx. intrinsics . get ( ~"llvm. log2 . f32 ") ;
1133
+ Store ( bcx, Call ( bcx, log2f, ~[ x] ) , fcx. llretptr ) ;
1134
+ }
1135
+ ~"log2f64" => {
1136
+ let x = get_param ( decl, first_real_arg) ;
1137
+ let log2f = ccx. intrinsics . get ( ~"llvm. log2 . f64 ") ;
1138
+ Store ( bcx, Call ( bcx, log2f, ~[ x] ) , fcx. llretptr ) ;
1139
+ }
1140
+ ~"fmaf32" => {
1141
+ let a = get_param ( decl, first_real_arg) ;
1142
+ let b = get_param ( decl, first_real_arg + 1 u) ;
1143
+ let c = get_param ( decl, first_real_arg + 2 u) ;
1144
+ let fmaf = ccx. intrinsics . get ( ~"llvm. fma . f32 ") ;
1145
+ Store ( bcx, Call ( bcx, fmaf, ~[ a, b, c] ) , fcx. llretptr ) ;
1146
+ }
1147
+ ~"fmaf64" => {
1148
+ let a = get_param ( decl, first_real_arg) ;
1149
+ let b = get_param ( decl, first_real_arg + 1 u) ;
1150
+ let c = get_param ( decl, first_real_arg + 2 u) ;
1151
+ let fmaf = ccx. intrinsics . get ( ~"llvm. fma . f64 ") ;
1152
+ Store ( bcx, Call ( bcx, fmaf, ~[ a, b, c] ) , fcx. llretptr ) ;
1153
+ }
1154
+ ~"fabsf32" => {
1155
+ let x = get_param ( decl, first_real_arg) ;
1156
+ let fabsf = ccx. intrinsics . get ( ~"llvm. fabs . f32 ") ;
1157
+ Store ( bcx, Call ( bcx, fabsf, ~[ x] ) , fcx. llretptr ) ;
1158
+ }
1159
+ ~"fabsf64" => {
1160
+ let x = get_param ( decl, first_real_arg) ;
1161
+ let fabsf = ccx. intrinsics . get ( ~"llvm. fabs . f64 ") ;
1162
+ Store ( bcx, Call ( bcx, fabsf, ~[ x] ) , fcx. llretptr ) ;
1163
+ }
1164
+ ~"floorf32" => {
1165
+ let x = get_param ( decl, first_real_arg) ;
1166
+ let floorf = ccx. intrinsics . get ( ~"llvm. floor . f32 ") ;
1167
+ Store ( bcx, Call ( bcx, floorf, ~[ x] ) , fcx. llretptr ) ;
1168
+ }
1169
+ ~"floorf64" => {
1170
+ let x = get_param ( decl, first_real_arg) ;
1171
+ let floorf = ccx. intrinsics . get ( ~"llvm. floor . f64 ") ;
1172
+ Store ( bcx, Call ( bcx, floorf, ~[ x] ) , fcx. llretptr ) ;
1173
+ }
1174
+ ~"ceilf32" => {
1175
+ let x = get_param ( decl, first_real_arg) ;
1176
+ let ceilf = ccx. intrinsics . get ( ~"llvm. ceil . f32 ") ;
1177
+ Store ( bcx, Call ( bcx, ceilf, ~[ x] ) , fcx. llretptr ) ;
1178
+ }
1179
+ ~"ceilf64" => {
1180
+ let x = get_param ( decl, first_real_arg) ;
1181
+ let ceilf = ccx. intrinsics . get ( ~"llvm. ceil . f64 ") ;
1182
+ Store ( bcx, Call ( bcx, ceilf, ~[ x] ) , fcx. llretptr ) ;
1183
+ }
1184
+ ~"truncf32" => {
1185
+ let x = get_param ( decl, first_real_arg) ;
1186
+ let truncf = ccx. intrinsics . get ( ~"llvm. trunc . f32 ") ;
1187
+ Store ( bcx, Call ( bcx, truncf, ~[ x] ) , fcx. llretptr ) ;
1188
+ }
1189
+ ~"truncf64" => {
1190
+ let x = get_param ( decl, first_real_arg) ;
1191
+ let truncf = ccx. intrinsics . get ( ~"llvm. trunc . f64 ") ;
1192
+ Store ( bcx, Call ( bcx, truncf, ~[ x] ) , fcx. llretptr ) ;
1193
+ }
1036
1194
_ => {
1037
1195
// Could we make this an enum rather than a string? does it get
1038
1196
// checked earlier?
0 commit comments